-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (50 loc) · 1.5 KB
/
build.yaml
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
name: build
on:
push:
branches:
- main
jobs:
ackal:
name: consul-sd-cloudrun
runs-on: ubuntu-latest
env:
IMAGE: dazwilkin/consul-sd-cloudrun
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup
uses: docker/setup-buildx-action@v2
- name: login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR }}
- name: Get kernel version
run: echo "VERSION=$(uname --kernel-release)" >> ${GITHUB_ENV}
- name: discoverer
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
build-args: |
TOKEN=${{ secrets.GHCR }}
VERSION=${{ env.VERSION }}
COMMIT=${{ github.sha }}
tags: ghcr.io/${{ env.IMAGE }}:${{ github.sha }}
push: true
- name: revise occurrences of the image
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
for FILENAME in "./README.md" "./docker-compose.yml"
do
echo "Replacing: ${IMAGE}"
sed \
--in-place \
"s|${IMAGE}:[0-9a-f]\{40\}|${IMAGE}:${{ github.sha }}|g" \
${FILENAME}
git add ${FILENAME}
done
git commit --message "GitHub Actions update image references"
git push origin main