-
Notifications
You must be signed in to change notification settings - Fork 30
79 lines (74 loc) · 2.01 KB
/
ghcr.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
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
---
name: Publish Docker
on:
push:
env:
IMAGE_TAG: ghcr.io/${{ github.repository_owner }}/arma-reforger:latest
jobs:
build:
name: Build Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Image
run: docker build . -t arma-reforger
- name: Save Image
run: docker save arma-reforger | gzip > image.tar.gz
- uses: actions/upload-artifact@v2
with:
name: image
path: image.tar.gz
if-no-files-found: error
retention-days: 7
test:
name: Test Image
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@v2
with:
name: image
- name: Load Image
run: docker load < image.tar.gz
- name: Run Image
run: >
docker run -d
-e SERVER_A2S_ADDRESS=0.0.0.0
-e SERVER_A2S_PORT=17777
-p 17777:17777/udp
arma-reforger
- name: Install python dependencies
run: python3 -m pip install python-a2s
- name: Run Test
run: python3 ./.github/scripts/steam-query.py
main_publish:
name: Publish Image
runs-on: ubuntu-latest
needs:
- build
- test
if: github.ref == 'refs/heads/main'
steps:
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v2
with:
name: image
- name: Load Image
run: docker load < image.tar.gz
- name: Tag Image
run: docker tag arma-reforger "$IMAGE_TAG"
- name: Push Image
run: docker push "$IMAGE_TAG"