Skip to content

Commit

Permalink
refs/heads/58-push-a-tag-after-testing-artifacts (#67)
Browse files Browse the repository at this point in the history
## Test evidence

In
https://github.com/fairy-select/chronovoyage/actions/runs/11874448826,
the `push-tag` job has properly failed because of tag duplicates and the
other jobs have succeed.

---------

Co-authored-by: Noritaka IZUMI <[email protected]>
  • Loading branch information
chronovoyage-app[bot] and noritakaIzumi authored Nov 17, 2024
1 parent 92b2a39 commit 91d7a6c
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions .github/workflows/create-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ env:
tag-prefix: "v"

jobs:
push-tag:
name: Push a tag
get-tag-name:
if: ${{ contains(github.event.pull_request.labels.*.name, 'new release') && github.event.pull_request.merged }}
name: Get current version
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.tag.outputs.version }}
tag: ${{ steps.tag.outputs.tag }}
Expand All @@ -27,40 +25,59 @@ jobs:
- name: Install Hatch
uses: pypa/hatch@install

- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Push a tag
- name: Get current version and create tag name
id: tag
run: |
version="$(hatch version)"
tag="${{ env.tag-prefix }}${version}"
git tag -a ${tag} -m "New release ${tag} (tagged by github-actions[bot])"
git push origin ${tag}
echo "version=${version}" >> $GITHUB_OUTPUT
echo "tag=${tag}" >> $GITHUB_OUTPUT
build-package:
needs:
- push-tag
- get-tag-name
uses: ./.github/workflows/build-pip-package.yml
with:
version: ${{ needs.push-tag.outputs.version }}
version: ${{ needs.get-tag-name.outputs.version }}

build-docs:
needs:
- push-tag
- get-tag-name
uses: ./.github/workflows/build-docs.yml

push-tag:
name: Push a tag
needs:
- get-tag-name
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Push a tag
id: tag
run: |
tag=${{ needs.get-tag-name.outputs.tag }}
git tag -a ${tag} -m "New release ${tag} (tagged by github-actions[bot])"
git push origin ${tag}
echo "tag=${tag}" >> $GITHUB_OUTPUT
create-release:
name: Create a release
runs-on: ubuntu-latest
needs:
- push-tag
- build-package
- build-docs
- push-tag
permissions:
contents: write
steps:
Expand Down

0 comments on commit 91d7a6c

Please sign in to comment.