diff --git a/.github/workflows/publish-github-release.yaml b/.github/workflows/publish-github-release.yaml index 3da1bd6..c20e69f 100644 --- a/.github/workflows/publish-github-release.yaml +++ b/.github/workflows/publish-github-release.yaml @@ -1,4 +1,4 @@ -name: Publish GitHub release +name: Publish GitHub release — legacy path, please switch! on: workflow_call: @@ -7,25 +7,4 @@ jobs: Publish: permissions: contents: write - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - steps: - - name: Calculate release name - run: | - GITHUB_REF=${{ github.ref }} - RELEASE_NAME=${GITHUB_REF#"refs/tags/"} - echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV - # We'd use `github.event.head_commit.message`, but that includes the first line of the message. So we check out the code. - - name: Check out code for release body calculation using `git` itself - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Calculate release body - run: git log --format=%b -n 1 HEAD >> /tmp/body-path.txt - - name: Publish release - uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.RELEASE_NAME }} - body_path: /tmp/body-path.txt - draft: false - prerelease: false + uses: ./workflows/publish-github-release/workflow.yaml diff --git a/README.md b/README.md index b50b612..d3bb4d2 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ jobs: permissions: contents: write if: startsWith(github.ref, 'refs/tags/v') - uses: cubing/actions-workflows/.github/workflows/publish-github-release.yaml@main + uses: cubing/actions-workflows/workflows/publish-github-release@main CONTENTS ``` diff --git a/workflows/publish-github-release/workflow.yaml b/workflows/publish-github-release/workflow.yaml new file mode 100644 index 0000000..3da1bd6 --- /dev/null +++ b/workflows/publish-github-release/workflow.yaml @@ -0,0 +1,31 @@ +name: Publish GitHub release + +on: + workflow_call: + +jobs: + Publish: + permissions: + contents: write + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Calculate release name + run: | + GITHUB_REF=${{ github.ref }} + RELEASE_NAME=${GITHUB_REF#"refs/tags/"} + echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV + # We'd use `github.event.head_commit.message`, but that includes the first line of the message. So we check out the code. + - name: Check out code for release body calculation using `git` itself + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Calculate release body + run: git log --format=%b -n 1 HEAD >> /tmp/body-path.txt + - name: Publish release + uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.RELEASE_NAME }} + body_path: /tmp/body-path.txt + draft: false + prerelease: false