-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 1.73 KB
/
golang-build-117.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: golang-build-117
on:
push:
branches:
- 'main'
- 'podman'
paths:
- golang/build/alpine/1.17/Dockerfile
- golang/build/alpine/1.17/version.json
jobs:
build:
name: Build and push image
environment: production
runs-on: ubuntu-22.04
env:
context: ./golang/build/alpine/1.17
steps:
- uses: actions/checkout@v2
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Get image tags
id: image_tags
run: |
echo -n ::set-output name=IMAGE_TAGS::
VERSION=$(jq -r '.version' ${context}/version.json)
if [ "${VERSION}" ] && [ "${VERSION}" != "latest" ]; then
echo ${VERSION}
elif [[ "${GITHUB_REF}" =~ refs/tags/(.*) ]]; then
echo ${BASH_REMATCH[1]}
else
echo ${{ github.sha }}
fi
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: golang-build
build-args: TIMEZONE=Asia/Shanghai
tags: ${{ steps.image_tags.outputs.IMAGE_TAGS }}
archs: amd64, arm64
context: golang/build/alpine/1.17/
containerfiles: golang/build/alpine/1.17/Dockerfile
- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/${{ secrets.REGISTRY_USERNAME }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"