-
Notifications
You must be signed in to change notification settings - Fork 17
82 lines (74 loc) · 2.33 KB
/
arm.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: arm-build
on:
push:
branches: ["master"]
pull_request:
branches: ["**"]
jobs:
publish-arm-production:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: ${{ (github.ref_name == 'master') && (github.event_name == 'push')}}
steps:
- uses: actions/checkout@v3
- name: setup env variables
id: vars
run: |
SHA=${GITHUB_SHA:0:7}
echo "SHA=$SHA" >> $GITHUB_ENV
echo "IMAGE=ghcr.io/segmentio/ctlstore:$SHA-arm" >> $GITHUB_ENV
- name: "Image Name"
run: echo "publishing ${IMAGE}"
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: true
- name: Build and push image for master
run: |
docker context create buildx-build
docker buildx create --use buildx-build
docker buildx build \
--platform=linux/arm64 \
-t ${IMAGE} \
--build-arg VERSION=${SHA} \
--push \
.
publish-arm-pr:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: ${{ (github.event_name == 'pull_request') }}
steps:
- uses: actions/checkout@v3
- name: setup env variables
id: vars
run: |
SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})
echo "SHA=$SHA" >> $GITHUB_ENV
echo "IMAGE=ghcr.io/segmentio/ctlstore:$(echo ${GITHUB_HEAD_REF:0:116} | sed 's/[^a-zA-Z0-9]/-/g' )-$SHA-arm" >> $GITHUB_ENV
- name: "Image Name"
run: echo "publishing ${IMAGE}"
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: true
- name: Build and push image for pull request
run: |
docker context create buildx-build
docker buildx create --use buildx-build
docker buildx build \
--platform=linux/arm64 \
-t ${IMAGE} \
--build-arg VERSION=${SHA} \
--push \
.
- run: echo "GHCR PUBLISH SUCCESSFUL"