From f46a5238a16b28b1e6388287c52a0abe21dbb2ef Mon Sep 17 00:00:00 2001 From: wouterpeere Date: Fri, 26 Jan 2024 18:48:04 +0100 Subject: [PATCH] Change action behaviour --- .github/workflows/CD.yml | 13 +++---- .github/workflows/docs.yml | 2 +- .github/workflows/release.yml | 64 ----------------------------------- 3 files changed, 5 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index ff0dbdb8..d68cd2bc 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -1,16 +1,11 @@ name: CD to pypi on: - push: - branches: - - master - -permissions: - contents: write + release: + types: [ published, unpublished ] jobs: build: - if: "contains(github.event.head_commit.message, 'auto-update version')" name: Build distribution 📦 runs-on: ubuntu-latest @@ -36,7 +31,7 @@ jobs: publish-to-testpypi: needs: build - if: "contains(github.event.head_commit.message, 'rc') || contains(github.event.head_commit.message, 'dev')" + if: "contains(github.event.release.name, 'rc') || contains(github.event.release.name, 'dev')" name: Publish 📦 to TestPyPI runs-on: ubuntu-latest @@ -59,7 +54,7 @@ jobs: publish-to-pypi: needs: build - if: "!contains(github.event.head_commit.message, 'rc') && !contains(github.event.head_commit.message, 'dev')" + if: "!contains(github.event.release.name, 'rc') && !contains(github.event.release.name, 'dev')" name: Publish 📦 to PyPI runs-on: ubuntu-latest diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index dae65992..4256d7a6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,5 +1,5 @@ name: Create docs -on: [push, release] +on: push jobs: notebooks: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4a9ed7fc..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: A new release - -on: - release: - types: [ published ] - -permissions: - contents: write - -jobs: - unit-tests: - name: release tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.12 - uses: actions/setup-python@v3 - with: - python-version: '3.12' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - pip install pytest-cov - pip install -e . - - name: Test with pytest - run: pytest GHEtool/test/unit-tests --cov=./ --cov-report=xml - - create-tag: - name: Set tag - needs: unit-tests - runs-on: ubuntu-latest - env: - RELEASE_VERSION: "" - STRIPPED_VERSION: "" - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - token: ${{ secrets.TOKEN }} - persist-credentials: false - - - name: Set output - id: vars - run: echo "RELEASE_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV - - - name: Check output - id: split - run: echo "STRIPPED_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV - - - name: Set up Git - run: git config --global user.email "${{ secrets.EMAIL }}" && git config --global user.name "GitHub Actions" - - - name: Update version in version file and commit - run: | - echo "${STRIPPED_VERSION}" > VERSION.txt - cat VERSION.txt - git add VERSION.txt - git commit -am "Release: auto-update version to ${RELEASE_VERSION}" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.TOKEN }} \ No newline at end of file