diff --git a/.github/workflows/publish-to-docker.yaml b/.github/workflows/publish-a-release.yaml similarity index 51% rename from .github/workflows/publish-to-docker.yaml rename to .github/workflows/publish-a-release.yaml index d0eba5ca..23e8276f 100644 --- a/.github/workflows/publish-to-docker.yaml +++ b/.github/workflows/publish-a-release.yaml @@ -1,20 +1,58 @@ -name: Publish to Docker Hub +name: Publish a Release # GitHub events that triggers the workflow: on: release: types: - published - workflow_dispatch: # to make the workflow triggerable manually + +permissions: + contents: write jobs: - call_tests_workflow: - name: Test + call_test_workflow: + name: Run Tests uses: ./.github/workflows/test.yaml - push_to_registry: - name: Release docker image + publish_to_pypi: + name: Publish to PyPI + needs: + - call_test_workflow runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Install Hatch + uses: pypa/hatch@install + + - name: Check if the release tag matches the version + uses: samuelcolvin/check-python-version@v4.1 + with: + version_file_path: rendercv/__init__.py + + - name: Build + run: | + hatch build + + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - name: Upload wheel and source distribution + uses: softprops/action-gh-release@v2 + with: + files: | + dist/*.whl + dist/*.tar.gz + + publish_to_dockerhub: + name: Publish to Docker Hub + needs: + - publish_to_pypi + runs-on: ubuntu-latest + environment: release permissions: packages: write contents: read @@ -52,3 +90,9 @@ jobs: subject-name: rendercv/rendercv subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true + + call_update_files_workflow: + name: Update files + needs: + - publish_to_pypi + uses: ./.github/workflows/update-files.yaml diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml deleted file mode 100644 index c92f4717..00000000 --- a/.github/workflows/publish-to-pypi.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish to PyPI and update files - -# GitHub events that triggers the workflow: -on: - release: - types: - - published - -permissions: - contents: write - -jobs: - call_tests_workflow: - name: Test - uses: ./.github/workflows/test.yaml - - publish: - name: Publish to PyPI - needs: - - call_tests_workflow - runs-on: ubuntu-latest - environment: release - - permissions: - id-token: write - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Hatch - uses: pypa/hatch@install - - - name: Check if the release tag matches the version - uses: samuelcolvin/check-python-version@v4.1 - with: - version_file_path: rendercv/__init__.py - - - name: Build - run: | - hatch build - - - name: Upload package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - - name: Upload wheel and source distribution - uses: softprops/action-gh-release@v2 - with: - files: | - dist/*.whl - dist/*.tar.gz - - call_update_files_workflow: - name: Update files - needs: - - publish - uses: ./.github/workflows/update-files.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2cdc6023..6742532b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,8 +25,6 @@ jobs: runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v4 - with: - submodules: recursive - name: Install Hatch uses: pypa/hatch@install diff --git a/.github/workflows/update-files.yaml b/.github/workflows/update-files.yaml index 093a8daf..bc6c211e 100644 --- a/.github/workflows/update-files.yaml +++ b/.github/workflows/update-files.yaml @@ -2,7 +2,7 @@ name: Update files # GitHub events that triggers the workflow: on: - workflow_call: # to make the workflow triggerable from other workflows (publish-to-pypi.yaml) + workflow_call: # to make the workflow triggerable from other workflows (on-publish.yaml) workflow_dispatch: # to make the workflow triggerable manually jobs: @@ -15,8 +15,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - submodules: recursive - name: Install Hatch uses: pypa/hatch@install