Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix: mark releases as latest correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Jul 21, 2023
1 parent d9355df commit c89c971
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
printf "output<<$EOF\n%s\n$EOF" "$output" >> $GITHUB_OUTPUT
- id: release
if: github.event.pull_request.head.repo.full_name == github.repository
uses: galargh/action-gh-release@25b3878b4c346655a4d3d9bea8b76638f64743cf # https://github.com/softprops/action-gh-release/pull/316
uses: galargh/action-gh-release@571276229e7c9e6ea18f99bad24122a4c3ec813f # https://github.com/softprops/action-gh-release/pull/316
with:
draft: true
tag_name: ${{ steps.version.outputs.version }}
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ jobs:
- uses: actions/checkout@v3
- id: version
name: Determine version
run: echo "version=$(jq -r .version version.json)" >> $GITHUB_OUTPUT
run: jq -r .version version.json | xargs -I{} echo "version={}" | tee -a $GITHUB_OUTPUT
- id: latest
name: Determine latest version
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
git fetch origin --tags
echo -e "$VERSION\n$(git tag)" | sort -V | tail -n1 | xargs -I{} echo "latest={}" | tee -a $GITHUB_OUTPUT
- id: labels
name: Determine PR labels if this commit is a merged PR (if we're not on a default branch)
if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
run: echo "labels=$(gh api -X GET "$ENDPOINT" --jq "$SELECTOR" -f sort="$SORT" -f direction="$DIRECTION" -f state="$STATE")" >> $GITHUB_OUTPUT
run: echo "labels=$(gh api -X GET "$ENDPOINT" --jq "$SELECTOR" -f sort="$SORT" -f direction="$DIRECTION" -f state="$STATE")" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ github.token }}
ENDPOINT: repos/${{ github.repository }}/pulls
Expand All @@ -31,7 +38,7 @@ jobs:
if: steps.version.outputs.version != '' && steps.tag.outputs.exists == 'false' && (
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
contains(fromJSON(steps.labels.outputs.labels), 'release'))
uses: galargh/action-gh-release@25b3878b4c346655a4d3d9bea8b76638f64743cf # https://github.com/softprops/action-gh-release/pull/316
uses: galargh/action-gh-release@571276229e7c9e6ea18f99bad24122a4c3ec813f # https://github.com/softprops/action-gh-release/pull/316
with:
draft: false
tag_name: ${{ steps.version.outputs.version }}
Expand All @@ -47,7 +54,8 @@ jobs:
"url": "${{ steps.release.outputs.url }}",
"id": "${{ steps.release.outputs.id }}",
"upload_url": "${{ steps.release.outputs.upload_url }}",
"assets": ${{ steps.release.outputs.assets }}
"assets": ${{ steps.release.outputs.assets }},
"make_latest": ${{ steps.version.outputs.version == steps.latest.outputs.latest }}
}
run: jq . <<< "$RELEASE" > release.json
- name: Upload release.json
Expand Down

0 comments on commit c89c971

Please sign in to comment.