-
Notifications
You must be signed in to change notification settings - Fork 20
60 lines (53 loc) · 2.5 KB
/
post-announce.yml
File metadata and controls
60 lines (53 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Bump action runner version
on:
workflow_call:
inputs:
plan:
required: true
type: string
jobs:
main:
runs-on: ubuntu-latest
env:
PLAN: ${{ inputs.plan }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Plan details
run: |
echo "Plan details: $PLAN"
- name: Check if runner was released
id: check_runner
run: |
IS_PRE_RELEASE=$(echo ${PLAN} | jq '.announcement_is_prerelease')
NEW_VERSION=$(echo ${PLAN} | jq -r '.releases[] | select(.app_name == "codspeed-runner") | .app_version')
RELEASE_TAG=$(echo ${PLAN} | jq -r '.announcement_tag')
echo "is_pre_release=${IS_PRE_RELEASE}" >> "$GITHUB_OUTPUT"
echo "new_version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
echo "release_tag=${RELEASE_TAG}" >> "$GITHUB_OUTPUT"
if [ "${IS_PRE_RELEASE}" == "true" ]; then
echo "runner_released=false" >> "$GITHUB_OUTPUT"
echo "Pre-release detected, cargo-dist has already undrafted this release, nothing more to do"
elif [ -z "${NEW_VERSION}" ] || [ "${NEW_VERSION}" == "null" ]; then
echo "runner_released=false" >> "$GITHUB_OUTPUT"
echo "A package other than the runner has been released, cargo-dist has already undrafted this release, nothing more to do"
else
echo "runner_released=true" >> "$GITHUB_OUTPUT"
echo "Runner version ${NEW_VERSION} was released"
fi
- name: Mark release as latest
if: steps.check_runner.outputs.runner_released == 'true'
run: |
RELEASE_TAG="${{ steps.check_runner.outputs.release_tag }}"
REPO_OWNER=$(echo ${PLAN} | jq -r '.releases[0].hosting.github.owner')
REPO_NAME=$(echo ${PLAN} | jq -r '.releases[0].hosting.github.repo')
echo "Marking release ${RELEASE_TAG} as latest"
gh release edit "${RELEASE_TAG}" -R "${REPO_OWNER}/${REPO_NAME}" --latest
- name: Trigger action runner version bump workflow
if: steps.check_runner.outputs.runner_released == 'true'
env:
GH_TOKEN: ${{ secrets.PAT_CODSPEED_ACTION }}
run: |
NEW_VERSION="${{ steps.check_runner.outputs.new_version }}"
echo "Triggering action runner version bump for version ${NEW_VERSION}"
# Trigger the bump-runner-version workflow in the CodSpeedHQ/action repository
gh workflow run bump-runner-version.yml -R CodSpeedHQ/action -f version=${NEW_VERSION}