Skip to content

Commit c1c2e2f

Browse files
committed
ci/package_tool: verify upload step as well
This commit updates the logic to ensure that the final verification step checks the results of both the build and publish stages.
1 parent bb9e26e commit c1c2e2f

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

.github/workflows/package_tool.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ concurrency:
2727

2828
jobs:
2929

30+
# Set up the build matrix based on the event type. For tag pushes, the matrix
31+
# will contain only the tool and version specified by the tag. For pull
32+
# requests, the matrix will include all tools with the version set to the
33+
# commit SHA. Also determine if this is a release build on the main
34+
# repository, and if so, set the tool artifact name for later use.
35+
3036
setup:
3137
name: Set up build matrix
3238
runs-on: ubuntu-latest
@@ -63,6 +69,9 @@ jobs:
6369
fi
6470
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
6571
72+
# Build and package the tools in parallel according to the matrix, uploading
73+
# the resulting packages and metadata as artifacts for later use.
74+
6675
build-tool:
6776
name: Build ${{ matrix.tool }} ${{ matrix.version }}
6877
needs: setup
@@ -81,10 +90,10 @@ jobs:
8190
go-version: stable
8291
cache: false
8392

84-
- name: Build and package ${{ matrix.tool }}
93+
- name: Build and package tool
8594
run: extra/package_tool.sh tools/${{ matrix.tool }} ${{ matrix.version }}
8695

87-
- name: Upload ${{ matrix.tool }} ${{ matrix.version }}
96+
- name: Upload tool artifact
8897
uses: actions/upload-artifact@v7
8998
with:
9099
name: ${{ matrix.tool }}-${{ matrix.version }}
@@ -93,23 +102,13 @@ jobs:
93102
distrib/*.zip
94103
retention-days: 7
95104

96-
- name: Upload JSON ${{ matrix.tool }} ${{ matrix.version }}
105+
- name: Upload JSON artifact
97106
uses: actions/upload-artifact@v7
98107
with:
99108
name: ${{ matrix.tool }}-${{ matrix.version }}.json
100109
path: distrib/*.json
101110
archive: false
102111
retention-days: 7
103-
if-no-files-found: ignore
104-
105-
verify-tool:
106-
runs-on: ubuntu-latest
107-
if: always()
108-
needs: build-tool
109-
steps:
110-
- name: Check build result
111-
run: |
112-
[ "${{ needs.build-tool.result }}" == "success" ]
113112

114113
# Upload the built tool packages to the S3 bucket for public distribution.
115114

@@ -137,10 +136,24 @@ jobs:
137136
role-to-assume: ${{ secrets.IAM_ROLE }}
138137
aws-region: ${{ secrets.AWS_REGION }}
139138

140-
- name: Upload tools to S3
139+
- name: Upload tool files to S3
141140
run: |
142141
for f in *.tar.gz *.zip ; do
143142
[ -f "$f" ] || continue
144143
aws s3 cp "$f" s3://${{ secrets.S3_TOOLS_BUCKET }}/
145144
done
146145
146+
# The final verification step always runs to properly get the overall job status.
147+
148+
verify-tool:
149+
runs-on: ubuntu-latest
150+
if: always()
151+
needs:
152+
- build-tool
153+
- publish-tool
154+
steps:
155+
- name: Check build result
156+
run: |
157+
# A failure here means either the build or publish step failed when it was expected to run.
158+
[ ${{ needs.build-tool.result }} == "success" ] && \
159+
( [ ${{ needs.publish-tool.result }} == "success" ] || [ ${{ needs.publish-tool.result }} == "skipped" ] )

0 commit comments

Comments
 (0)