From d4c6e5c064293b38725c70bec1d7b17070716e44 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Thu, 10 Aug 2023 03:46:51 +0000 Subject: [PATCH] Recombined workflows and release filter --- .github/workflows/make-release.yml | 50 ------------------- ...{test-release.yml => test-and-release.yml} | 33 +++++++++++- 2 files changed, 32 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/make-release.yml rename .github/workflows/{test-release.yml => test-and-release.yml} (62%) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml deleted file mode 100644 index dbdced0..0000000 --- a/.github/workflows/make-release.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: 'Release Yakut Workflow' -on: - push: - branches: [ main ] - tags: [ '#release' ] - -# Ensures that only one workflow is running at a time -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - yakut-release: - name: Release Yakut - runs-on: ubuntu-latest - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Wait for test job to complete - uses: lewagon/wait-on-check-action@v1.3.1 - with: - ref: ${{ github.sha }} - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 10 - running-workflow-name: 'Release Yakut' - allowed-conclusions: success,skipped,cancelled - - - name: Create distribution wheel - run: | - git submodule update --init --recursive - python -m pip install --upgrade pip setuptools wheel twine - python setup.py sdist bdist_wheel - - - name: Get release version - run: echo "yakut_version=$(cat yakut/VERSION)" >> $GITHUB_ENV - - - name: Upload distribution - run: | - python -m twine upload dist/* - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_YAKUT }} - - - name: Push version tag - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - custom_tag: ${{ env.yakut_version }} - tag_prefix: '' diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-and-release.yml similarity index 62% rename from .github/workflows/test-release.yml rename to .github/workflows/test-and-release.yml index 21d5052..d1b11b8 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-and-release.yml @@ -1,4 +1,4 @@ -name: 'Test Yakut Workflow' +name: 'Test and Release Yakut' on: [ push, pull_request ] # Ensures that only one workflow is running at a time - required for duplicate pushes and repushing a PR @@ -54,3 +54,34 @@ jobs: nox --non-interactive --session test --python ${{ matrix.python }} nox --non-interactive --session lint + yakut-release: + name: Release Yakut + runs-on: ubuntu-latest + if: contains(github.event.head_commit.message, '#release') || contains(github.ref, '/main') + needs: yakut-test + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Create distribution wheel + run: | + git submodule update --init --recursive + python -m pip install --upgrade pip setuptools wheel twine + python setup.py sdist bdist_wheel + + - name: Get release version + run: echo "yakut_version=$(cat yakut/VERSION)" >> $GITHUB_ENV + + - name: Upload distribution + run: | + python -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_YAKUT }} + + - name: Push version tag + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ env.yakut_version }} + tag_prefix: ''