Skip to content

Commit e662fe4

Browse files
authored
Change release workflow to trigger on release (#283)
This will make it easier to maintainers to cut a release without having to manually create tags in the repo.
1 parent 9e826e2 commit e662fe4

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

.github/workflows/release.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: release
22
on:
3-
push:
4-
tags:
5-
- "v*"
3+
release:
4+
types: [published]
65
permissions:
76
contents: read
87
packages: write
@@ -20,6 +19,7 @@ jobs:
2019
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
2120
with:
2221
go-version-file: go.mod
22+
cache: false
2323
- name: Set up Docker
2424
uses: docker/setup-docker-action@0234bb73ccb40f0c430b795634f9247e2b5c2d23 #v5.2.0
2525
with:
@@ -39,22 +39,13 @@ jobs:
3939
registry: ghcr.io
4040
username: ${{ github.repository_owner }}
4141
password: ${{ secrets.GITHUB_TOKEN }}
42-
- name: Prepare versions
43-
id: prep
44-
run: |
45-
IMG_TAG="${GITHUB_REF_NAME}"
46-
if [[ "${{ github.ref_type }}" == "tag" ]]; then
47-
HELM_VERSION=${GITHUB_REF_NAME#v}
48-
else
49-
HELM_VERSION="0.0.0-${GITHUB_REF_NAME}"
50-
fi
51-
echo "IMG_TAG=${IMG_TAG}" >> $GITHUB_OUTPUT
52-
echo "HELM_VERSION=${HELM_VERSION}" >> $GITHUB_OUTPUT
5342
- name: Build and push image
5443
run: |
55-
IMG_REF=$(make build-image-multiarch IMG_REPOSITORY=${{ github.repository_owner }}/netbird-operator IMG_TAG=${{ steps.prep.outputs.IMG_TAG }}) || exit 1
44+
IMG_REF=$(make build-image-multiarch IMG_REPOSITORY=${{ github.repository_owner }}/netbird-operator IMG_TAG=${{ github.event.release.tag_name }}) || exit 1
5645
docker push ${IMG_REF}
5746
- name: Build and push Helm chart
5847
run: |
59-
helm package --app-version ${{ steps.prep.outputs.IMG_TAG }} --version ${{ steps.prep.outputs.HELM_VERSION }} charts/netbird-operator
60-
helm push netbird-operator-${{ steps.prep.outputs.HELM_VERSION }}.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts
48+
HELM_VERSION="${{ github.event.release.tag_name }}"
49+
HELM_VERSION="${HELM_VERSION#v}"
50+
helm package --app-version ${{ github.event.release.tag_name }} --version ${HELM_VERSION} charts/netbird-operator
51+
helm push netbird-operator-${HELM_VERSION}.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts

0 commit comments

Comments
 (0)