-
Notifications
You must be signed in to change notification settings - Fork 43
76 lines (72 loc) · 2.38 KB
/
ts-deploy.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
name: Deploy to Test Server
on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ dev ]
permissions:
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/tum-dev/gocast/test-server
tags: |
type=sha
flavor: |
latest=true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
pull: true
push: true
build-args: version=${{ steps.vars.outputs.sha_short }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker meta
id: metaWorker
uses: docker/metadata-action@v4
with:
images: ghcr.io/tum-dev/gocast/test-worker
tags: |
type=sha
flavor: |
latest=true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: worker
pull: true
push: true
build-args: version=${{ steps.vars.outputs.sha_short }}
tags: ${{ steps.metaWorker.outputs.tags }}
labels: ${{ steps.metaWorker.outputs.labels }}
- name: Pull new Container
run: |
curl -X POST -H "Content-Type: application/json" -H "Authorization: Token ${{ secrets.TESTSERVER_UPDATER_SECRET }}" -d '${{ toJSON(steps.meta.outputs) }}' https://update.test.live.mm.rbg.tum.de/add?num=${{ github.event.number }}