Skip to content

Commit 52fb0c4

Browse files
authored
Merge pull request #340 from codefresh-io/fix-release-workflow
ci: Fix release workflow
2 parents 51889c7 + 9b163b6 commit 52fb0c4

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

.github/workflows/release.yaml

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55
tags:
66
- v*
77
branches:
8-
- master
9-
- release-*
8+
- main
109
- dev-*
1110

1211
concurrency:
@@ -21,13 +20,13 @@ permissions:
2120
contents: read
2221

2322
jobs:
24-
build-linux-amd64:
23+
build-linux:
2524
name: Build & push linux
2625
if: github.repository == 'codefresh-io/argo-workflows'
2726
runs-on: ubuntu-latest
2827
strategy:
2928
matrix:
30-
platform: [ linux/amd64 ]
29+
platform: [ linux/amd64, linux/arm64 ]
3130
target: [ workflow-controller, argocli, argoexec ]
3231
steps:
3332
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -97,7 +96,7 @@ jobs:
9796
- name: Login to Quay
9897
uses: Azure/docker-login@83efeb77770c98b620c73055fbb59b2847e17dc0 # v1.0.1
9998
with:
100-
registry: quay.io
99+
login-server: quay.io
101100
username: ${{ secrets.QUAYIO_USERNAME }}
102101
password: ${{ secrets.QUAYIO_PASSWORD }}
103102

@@ -108,16 +107,21 @@ jobs:
108107
docker_org=$DOCKERIO_ORG
109108
110109
tag=$(basename $GITHUB_REF)
111-
if [ $tag = "master" ]; then
110+
if [ $tag = "main" ]; then
112111
tag="latest"
113112
fi
114113
115114
targets="argoexec"
116115
for target in $targets; do
117116
image_name="${docker_org}/${target}:${tag}-windows"
118-
docker build --target $target -t $image_name -f Dockerfile.windows .
119-
## Codefresh - remove dockerhub
120-
# docker push $image_name
117+
docker build \
118+
--build-arg GIT_COMMIT=$tag \
119+
--build-arg GIT_BRANCH=$branch \
120+
--build-arg GIT_TREE_STATE=$tree_state \
121+
--target $target \
122+
-t $image_name \
123+
-f Dockerfile.windows \
124+
.
121125
122126
docker tag $image_name quay.io/$image_name
123127
docker push quay.io/$image_name
@@ -128,14 +132,14 @@ jobs:
128132
name: Push manifest with all images
129133
if: github.repository == 'codefresh-io/argo-workflows'
130134
runs-on: ubuntu-latest
131-
needs: [ build-linux-amd64, build-linux-arm64, build-windows ]
135+
needs: [ build-linux, build-windows ]
132136
steps:
133137
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
134138

135139
- name: Login to Quay
136140
uses: Azure/docker-login@83efeb77770c98b620c73055fbb59b2847e17dc0 # v1.0.1
137141
with:
138-
registry: quay.io
142+
login-server: quay.io
139143
username: ${{ secrets.QUAYIO_USERNAME }}
140144
password: ${{ secrets.QUAYIO_PASSWORD }}
141145

@@ -148,7 +152,7 @@ jobs:
148152
docker_org=$DOCKERIO_ORG
149153
150154
tag=$(basename $GITHUB_REF)
151-
if [ $tag = "master" ]; then
155+
if [ $tag = "main" ]; then
152156
tag="latest"
153157
fi
154158
@@ -157,18 +161,13 @@ jobs:
157161
image_name="${docker_org}/${target}:${tag}"
158162
159163
if [ $target = "argoexec" ]; then
160-
## Codefresh - remove dockerhub
161-
# docker manifest create $image_name ${image_name}-linux-arm64 ${image_name}-linux-amd64 ${image_name}-windows
162164
docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 quay.io/${image_name}-windows
163165
else
164-
## Codefresh - remove dockerhub
165-
# docker manifest create $image_name ${image_name}-linux-arm64 ${image_name}-linux-amd64
166166
docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64
167167
fi
168168
169-
## Codefresh - remove dockerhub
170-
# docker manifest push $image_name
171169
docker manifest push quay.io/$image_name
170+
172171
done
173172
174173
test-images-linux-amd64:
@@ -195,7 +194,7 @@ jobs:
195194
TARGET: ${{ matrix.target }}
196195
run: |
197196
tag=$(basename $GITHUB_REF)
198-
if [ $tag = "master" ]; then
197+
if [ $tag = "main" ]; then
199198
tag="latest"
200199
fi
201200
@@ -220,7 +219,7 @@ jobs:
220219
run: |
221220
docker_org=$DOCKERIO_ORG
222221
tag=$(basename $GITHUB_REF)
223-
if [ $tag = "master" ]; then
222+
if [ $tag = "main" ]; then
224223
tag="latest"
225224
fi
226225
@@ -251,28 +250,36 @@ jobs:
251250
with:
252251
path: ui/node_modules
253252
key: ${{ runner.os }}-node-dep-v1-${{ hashFiles('**/yarn.lock') }}
254-
- name: go build cache
255-
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
256-
with:
257-
path: /home/runner/.cache/go-build
258-
key: GOCACHE-v2-${{ hashFiles('**/go.mod') }}
259-
- name: go mod cache
260-
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
261-
with:
262-
path: /home/runner/go/pkg/mod
263-
key: GOMODCACHE-v2-${{ hashFiles('**/go.mod') }}
264253
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
265-
- run: make release-notes VERSION=${GITHUB_REF##*/}
254+
- run: |
255+
if [ ${GITHUB_REF##*/} = main ]; then
256+
echo "VERSION=latest" >> $GITHUB_ENV
257+
else
258+
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
259+
fi
260+
- run: go install sigs.k8s.io/bom/cmd/[email protected]
261+
- run: go install github.com/spdx/spdx-sbom-generator/cmd/[email protected]
262+
- run: mkdir -p dist
263+
- run: generator -o dist -p .
264+
- run: yarn --cwd ui install
265+
- run: generator -o dist -p ui
266+
- run: bom generate --image quay.io/codefresh/workflow-controller:$VERSION -o dist/workflow-controller.spdx
267+
- run: bom generate --image quay.io/codefresh/argocli:$VERSION -o dist/argocli.spdx
268+
- run: bom generate --image quay.io/codefresh/argoexec:$VERSION -o dist/argoexec.spdx
269+
# pack the boms into one file to make it easy to download
270+
- run: tar -zcf dist/sbom.tar.gz dist/*.spdx
271+
- run: make release-notes VERSION=$VERSION
266272
- run: cat release-notes
267-
- run: make manifests VERSION=${GITHUB_REF##*/}
273+
- run: make manifests VERSION=$VERSION
268274
- name: Print image tag (please check it is not `:latest`)
269275
run: |
270276
grep image: dist/manifests/install.yaml
271277
- run: go mod download
272-
- run: make clis STATIC_FILES=true VERSION=${GITHUB_REF##*/}
278+
- run: make clis STATIC_FILES=true VERSION=$VERSION
273279
- name: Print version (please check it is not dirty)
274280
run: dist/argo-linux-amd64 version
275281
- run: make checksums
282+
276283
# https://github.com/softprops/action-gh-release
277284
# This will publish the release and upload assets.
278285
# If a conflict occurs (because you are not on a tag), the release will not be updated. This is a short coming
@@ -289,4 +296,4 @@ jobs:
289296
dist/manifests/*.yaml
290297
dist/sbom.tar.gz
291298
env:
292-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
299+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)