-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (55 loc) · 2.02 KB
/
ci.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
name: CI
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Remember if you commit this, newly built images will replace those tags.
# Prefer incrementing the version to unused one
tag: [6-bionic32, 6-mingw32, 6-focal32, 6-jammy32]
env:
dockertag: ${{ matrix.tag }}
REGISTRY: ghcr.io
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build docker image
run: |
ctxpath=${dockertag//-/\/}
SLUG=$(echo ${{ github.repository_owner }}/openloco | tr '[A-Z]' '[a-z]')
docker build -t openloco $ctxpath
- name: Push image to registry
if: github.event_name == 'push' && github.ref_name == 'master'
run: |
SLUG=$(echo ${{ github.repository_owner }}/openloco | tr '[A-Z]' '[a-z]')
if [ "${{ secrets.GITHUB_TOKEN }}" != "" ]; then
echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u $ --password-stdin
docker tag openloco $REGISTRY/$SLUG:$dockertag
docker push $REGISTRY/$SLUG:$dockertag
else
echo 'Image not pushed'
fi
tag:
name: Tag images
needs: build
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
steps:
- name: Tag docker images
if: github.event_name == 'push' && github.ref_name == 'master'
run: |
if [ "${{ secrets.GITHUB_TOKEN }}" != "" ]; then
SLUG=$(echo ${{ github.repository_owner }}/openloco | tr '[A-Z]' '[a-z]')
echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u $ --password-stdin
docker pull $REGISTRY/$SLUG:6-bionic32
docker tag $REGISTRY/$SLUG:6-bionic32 $REGISTRY/$SLUG:6
docker tag $REGISTRY/$SLUG:6-bionic32 $REGISTRY/$SLUG:latest
docker push $REGISTRY/$SLUG:6
docker push $REGISTRY/$SLUG:latest
else
echo 'Images not tagged'
fi