From 8e224173fe11c6f0cf6d46b8353be9bebba7a6b6 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 4 Dec 2023 15:14:19 +0100 Subject: [PATCH] Configure release CD Signed-off-by: Cristian Le --- .github/workflows/publish.yml | 52 ------------------ .github/workflows/release.yml | 92 ++++++++++++++++++++++++++++++++ .github/workflows/step_build.yml | 5 ++ 3 files changed, 97 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 819b50c9..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Publish -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+dev[0-9]+" - -permissions: - contents: read - -jobs: - pre-commit: - uses: ./.github/workflows/step_pre-commit.yml - - test-pip: - needs: [ pre-commit ] - uses: ./.github/workflows/step_tests-pip.yml - - test-conda: - needs: [ test-pip ] - uses: ./.github/workflows/step_tests-conda.yml - - test-ui: - needs: [ test-pip ] - uses: ./.github/workflows/step_tests-ui.yml - - build: - needs: [ test-conda, test-ui ] - uses: ./.github/workflows/step_build.yml - with: - upload: true - - publish: - needs: [ build ] - runs-on: ubuntu-latest - - environment: - name: pypi - url: https://pypi.org/p/jupytext - - permissions: - contents: read - id-token: write - - steps: - - uses: actions/download-artifact@v3 - with: - name: dist - path: dist - - name: Publish - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b315ea6d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,92 @@ +name: Release +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+dev[0-9]+" + workflow_dispatch: + inputs: + skip-tests: + type: boolean + description: Skip + default: false + ref: + type: string + description: Tag to release + required: true + +permissions: + contents: read + +jobs: + pre-commit: + uses: ./.github/workflows/step_pre-commit.yml + if: "! inputs.skip-tests" + + test-pip: + needs: [ pre-commit ] + uses: ./.github/workflows/step_tests-pip.yml + if: "! inputs.skip-tests" + + test-conda: + needs: [ test-pip ] + uses: ./.github/workflows/step_tests-conda.yml + if: "! inputs.skip-tests" + + test-ui: + needs: [ test-pip ] + uses: ./.github/workflows/step_tests-ui.yml + if: "! inputs.skip-tests" + + test-status: + needs: [ pre-commit, test-pip, test-conda, test-ui ] + runs-on: ubuntu-latest + steps: + - uses: re-actors/alls-green@release/v1 + with: + allowed-skips: pre-commit, test-pip, test-conda, test-ui + jobs: ${{ toJSON(needs) }} + if: always() + + build: + needs: [ test-status ] + uses: ./.github/workflows/step_build.yml + with: + upload: true + ref: ${{ inputs.ref }} + + publish: + needs: [ build ] + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/jupytext + + permissions: + contents: read + id-token: write + + steps: + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + + release: + needs: [ publish ] + name: Create release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + - uses: softprops/action-gh-release@v1 + with: + name: Jupytext ${{ inputs.ref || github.ref_name }} + draft: true + prerelease: ${{ contains(inputs.ref || github.ref, 'rc') }} + generate_release_notes: true diff --git a/.github/workflows/step_build.yml b/.github/workflows/step_build.yml index 4504eefb..8ee9106e 100644 --- a/.github/workflows/step_build.yml +++ b/.github/workflows/step_build.yml @@ -9,6 +9,9 @@ on: required: false default: false description: Upload build artifacts + ref: + type: string + description: Tag to build permissions: contents: read @@ -19,6 +22,8 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1