Skip to content

Commit e1fcd63

Browse files
authored
Fix the workflow by adding the version resolve step (#2159)
1 parent 461c016 commit e1fcd63

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

.github/workflows/publish-arc.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ jobs:
4848
tar zxvf ghr_v0.13.0_linux_amd64.tar.gz
4949
sudo mv ghr_v0.13.0_linux_amd64/ghr /usr/local/bin
5050
51+
- name: Set version env variable
52+
run: |
53+
# Define the release tag name based on the event type
54+
if [[ "${{ github.event_name }}" == "release" ]]; then
55+
echo "VERSION=$(cat ${GITHUB_EVENT_PATH} | jq -r '.release.tag_name')" >> $GITHUB_ENV
56+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
57+
echo "VERSION=${{ inputs.release_tag_name }}" >> $GITHUB_ENV
58+
fi
59+
5160
- name: Upload artifacts
5261
env:
5362
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -62,15 +71,6 @@ jobs:
6271
application_private_key: ${{ secrets.ACTIONS_ACCESS_PK }}
6372
organization: ${{ env.TARGET_ORG }}
6473

65-
- name: Set release tag name
66-
run: |
67-
# Define the release tag name based on the event type
68-
if [[ "${{ github.event_name }}" == "release" ]]; then
69-
echo "RELEASE_TAG_NAME=$(cat ${GITHUB_EVENT_PATH} | jq -r '.release.tag_name')" >> $GITHUB_ENV
70-
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
71-
echo "RELEASE_TAG_NAME=${{ github.event.inputs.release_tag_name }}" >> $GITHUB_ENV
72-
fi
73-
7474
- name: Resolve push to registries
7575
run: |
7676
# Define the push to registries based on the event type
@@ -86,15 +86,15 @@ jobs:
8686
gh auth login --with-token <<< ${{ steps.get_workflow_token.outputs.token }}
8787
8888
# Trigger the workflow run
89-
jq -n '{"event_type": "arc", "client_payload": {"release_tag_name": "${{ env.RELEASE_TAG_NAME }}", "push_to_registries": "${{ env.PUSH_TO_REGISTRIES }}" }}' \
89+
jq -n '{"event_type": "arc", "client_payload": {"release_tag_name": "${{ env.VERSION }}", "push_to_registries": "${{ env.PUSH_TO_REGISTRIES }}" }}' \
9090
| gh api -X POST /repos/actions-runner-controller/releases/dispatches --input -
9191
9292
- name: Job summary
9393
run: |
9494
echo "The [publish-arc](https://github.com/actions-runner-controller/releases/blob/main/.github/workflows/publish-arc.yaml) workflow has been triggered!" >> $GITHUB_STEP_SUMMARY
9595
echo "" >> $GITHUB_STEP_SUMMARY
9696
echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY
97-
echo "- Release tag: ${{ env.RELEASE_TAG_NAME }}" >> $GITHUB_STEP_SUMMARY
97+
echo "- Release tag: ${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY
9898
echo "- Push to registries: ${{ env.PUSH_TO_REGISTRIES }}" >> $GITHUB_STEP_SUMMARY
9999
echo "" >> $GITHUB_STEP_SUMMARY
100100
echo "**Status:**" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)