Skip to content

Commit 9f0db83

Browse files
authored
Workflow tweak (#33)
Thanks to Drew for suggesting we change the CV checklist, and thanks to Bijan for looking into how to validate that the tag looks right. Compare this to https://github.com/viamrobotics/ocean-prefilter/blob/main/.github/workflows/build-arm64-module.yml, which Bijan says works correctly. I have not tried this out: it's unclear to me how to do that before merging. * add step to validate semver tag when publishing a release * get all steps to depend on validating the tag
1 parent b934b76 commit 9f0db83

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

.github/workflows/publish.yml

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
on:
2-
push:
3-
tags:
4-
- '[0-9]+.[0-9]+.[0-9]+'
5-
- '[0-9]+.[0-9]+.[0-9]+-rc'
6-
- '[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
2+
release:
3+
types: [published]
74

85
env:
96
DOCKER_TAG: ghcr.io/${{ github.repository }}
107
VERSION: ${{ github.ref_name }}
118

129
jobs:
10+
validate-tag: # Make sure the tag we're publishing looks like semantic versioning
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Validate tag format
14+
run: |
15+
TAG="${{ github.event.release.tag_name }}"
16+
echo "Validating tag: '$TAG'"
17+
if [[ $TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]*)?$ ]]; then
18+
echo "Tag matches semver."
19+
else
20+
echo "Error: tag does not match semver."
21+
exit 1
22+
fi
23+
1324
container: # Upload the docker image to the Github Container Registry
25+
needs: [validate-tag]
1426
strategy:
1527
matrix:
1628
build_target:
@@ -58,8 +70,9 @@ jobs:
5870
push: ${{ github.event_name == 'release' }}
5971
file: etc/docker/${{ matrix.build_target.dockerfile }}
6072
build-args: ${{ matrix.build_target.build_args }}
73+
6174
module: # Upload the module to the Viam modular registry
62-
needs: [container]
75+
needs: [validate-tag, container]
6376
strategy:
6477
# Until Viam's tags get priorities, it is very important to deploy the Jetpack versions
6578
# *before* the CUDA versions. Otherwise, a Jetpack machine will use the CUDA version of the

0 commit comments

Comments
 (0)