diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9c8afb9..71c31f98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,20 +9,16 @@ permissions: contents: read jobs: - github-release: - name: Publish GitHub release + pre-checks: + name: Release Pre-Checks runs-on: ubuntu-latest permissions: - contents: write - env: - CHGLOG_VERSION: "0.15.4" + contents: read steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 0 - - name: Check PowerAPI package version + - name: Check if package version corresponds to git tag shell: python env: PYTHONPATH: ${{ github.workspace }}/src @@ -36,28 +32,15 @@ jobs: if git_tag != pkg_version: title = 'Invalid version' - file = 'powerapi/__init__.py' + file = 'src/powerapi/__init__.py' msg = f'Version mismatch between python package ({pkg_version}) and git tag ({git_tag})' print(f'::error title={title},file={file}::{msg}') sys.exit(1) - - name: Generate version changelog - run: | - set -euo pipefail - export BASE_URL="https://github.com/git-chglog/git-chglog/releases/download" - export FILENAME="git-chglog_${CHGLOG_VERSION}_linux_amd64.tar.gz" - curl -fsSL "${BASE_URL}/v${CHGLOG_VERSION}/${FILENAME}" |sudo tar xz --no-same-owner -C /usr/local/bin git-chglog - git-chglog --config .github/chglog/config.yml --output CHANGELOG.md "${GITHUB_REF_NAME}" - - - name: Create GitHub release - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 - with: - body_path: CHANGELOG.md - pypi-package: name: Publish Pypi package runs-on: ubuntu-latest - needs: github-release + needs: pre-checks permissions: contents: read id-token: write @@ -86,7 +69,7 @@ jobs: docker-image: name: Publish Docker image runs-on: ubuntu-latest - needs: github-release + needs: pre-checks permissions: contents: read packages: write @@ -130,3 +113,30 @@ jobs: platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + github-release: + name: Publish GitHub release + runs-on: ubuntu-latest + needs: [pre-checks, pypi-package, docker-image] + permissions: + contents: write + env: + CHGLOG_VERSION: "0.15.4" + + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Generate version changelog + run: | + set -euo pipefail + export BASE_URL="https://github.com/git-chglog/git-chglog/releases/download" + export FILENAME="git-chglog_${CHGLOG_VERSION}_linux_amd64.tar.gz" + curl -fsSL "${BASE_URL}/v${CHGLOG_VERSION}/${FILENAME}" |sudo tar xz --no-same-owner -C /usr/local/bin git-chglog + git-chglog --config .github/chglog/config.yml --output CHANGELOG.md "${GITHUB_REF_NAME}" + + - name: Create GitHub release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + with: + body_path: CHANGELOG.md