Skip to content

Commit aba62a6

Browse files
committed
Check for available releases instead of comparing latest
1 parent b7b6861 commit aba62a6

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

.github/workflows/releaser.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
release:
1111
runs-on: thevickypedia-default
1212
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v5
15+
1316
- name: Get Latest Runner Version
1417
run: |
1518
export LATEST_RUNNER_VERSION=$(curl -sL \
@@ -18,24 +21,22 @@ jobs:
1821
https://api.github.com/repos/actions/runner/releases/latest | jq .tag_name --raw-output)
1922
echo "LATEST_RUNNER_VERSION=$LATEST_RUNNER_VERSION" >> $GITHUB_ENV
2023
shell: bash
21-
- name: Get Latest Release Version
22-
run: |
23-
export LATEST_RELEASE_VERSION=$(curl -sL \
24-
-H "Accept: application/vnd.github+json" \
25-
-H "X-GitHub-Api-Version: 2022-11-28" \
26-
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq .tag_name --raw-output)
27-
echo "LATEST_RELEASE_VERSION=$LATEST_RELEASE_VERSION" >> $GITHUB_ENV
28-
shell: bash
24+
2925
- name: Judgement Day
3026
run: |
31-
if [ -z "${{ env.LATEST_RUNNER_VERSION }}" ] || [ -z "${{ env.LATEST_RELEASE_VERSION }}" ]; then
32-
echo "::error title=Version404::Current: '${{ env.LATEST_RUNNER_VERSION }}', Latest: '${{ env.LATEST_RELEASE_VERSION }}'"
33-
exit 1
34-
fi
35-
echo "::debug::Current GitHub Actions Runner version is: ${{ env.LATEST_RUNNER_VERSION }}"
36-
if [ "${{ env.LATEST_RUNNER_VERSION }}" != "${{ env.LATEST_RELEASE_VERSION }}" ]; then
27+
FOUND=$(curl -sL \
28+
-H "Accept: application/vnd.github+json" \
29+
-H "X-GitHub-Api-Version: 2022-11-28" \
30+
https://api.github.com/repos/${{ github.repository }}/releases \
31+
| jq --arg v "${{ env.LATEST_RUNNER_VERSION }}" \
32+
'[.[].tag_name] | index($v) != null')
33+
34+
if [ "$FOUND" != "true" ]; then
3735
echo "::notice title=${{ env.LATEST_RUNNER_VERSION }}::A new version of GitHub Actions Runner is available."
3836
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
git config user.name "github-actions[bot]"
39+
3940
notes="- [${{ env.LATEST_RUNNER_VERSION }}](https://github.com/actions/runner/releases/tag/${{ env.LATEST_RUNNER_VERSION }})"
4041
echo "$notes" > release_notes.txt
4142
cat release_notes.txt

0 commit comments

Comments
 (0)