-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (37 loc) · 1.09 KB
/
build-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: "Publish controller images"
on:
workflow_dispatch:
push:
paths:
- 'api/**'
- 'vpn/**'
- 'build.sh'
permissions:
packages: write
jobs:
publish_images:
name: 'Publish controller images'
runs-on: ubuntu-latest
env:
IMAGETAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- id: build
run: |
# Build the controller images
bash build.sh
- id: publish
run: |
# Publish the branch
trap 'buildah logout ghcr.io' EXIT
buildah login -u ${{ github.actor }} --password-stdin ghcr.io <<<"${{ secrets.GITHUB_TOKEN }}"
images=(${{ steps.build.outputs.images }})
urls=""
for image in "${images[@]}" ; do
buildah push $image docker://${image}:${IMAGETAG:?}
if [[ "${IMAGETAG}" == "main" || "${IMAGETAG}" == "master" ]]; then
buildah push $image docker://${image}:latest
fi
urls="${image}:${IMAGETAG} "$'\n'"${urls}"
done
echo "::notice title=Image URLs::${urls}"