-
Notifications
You must be signed in to change notification settings - Fork 13
55 lines (55 loc) · 1.74 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]
env:
dockerid: ${{ secrets.dockerid }}
dockerpass: ${{ secrets.dockerpass }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# List of tags to build and upload, remember to update this
tag: [0.4.15]
env:
dockertag: ${{ matrix.tag }}
dockerimg: openrct2/openrct2-cli
dockerlst: 0.4.15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build docker image
run: |
ctxpath=${dockertag//-/\/}/cli
echo "Building $dockerimg:$dockertag from $ctxpath..."
docker build -t $dockerimg:$dockertag $ctxpath
- name: Tag latest docker image
run: |
if [ "$dockertag" == "$dockerlst" ]; then
echo "Tagging $dockerimg:$dockertag as $dockerimg:latest..."
docker tag $dockerimg:$dockertag $dockerimg:latest
else
echo "Latest tag not updated"
fi
- name: Login to docker
run: |
if [ "$dockerid" != "" ]; then
docker login -u "$dockerid" -p "$dockerpass"
echo "Docker login successful"
else
echo "No docker login performed"
fi
- name: Publish docker images
if: startsWith(github.ref, 'refs/tags/v')
run: |
if [ "$dockerid" != "" ]; then
echo "Pushing $dockerimg:$dockertag..."
docker push $dockerimg:$dockertag
if [ "$dockertag" == "$dockerlst" ]; then
echo "Pushing $dockerimg:latest..."
docker push $dockerimg:latest
fi
else
echo "No docker images published"
fi