forked from OpenSlides/OpenSlides
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (71 loc) · 2.56 KB
/
build-images.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
---
name: Build Docker images for all OpenSlides services
on:
push:
branches:
- main
- stable/4*
workflow_dispatch:
jobs:
build:
name: Builds Docker images
outputs:
openslides-version: ${{ steps.readversion.outputs.version }}
runs-on: ubuntu-latest
strategy:
matrix:
service:
- name: proxy
- name: client
- name: backend
- name: datastore-reader
- name: datastore-writer
- name: autoupdate
- name: auth
- name: search
- name: vote
- name: icc
- name: media
- name: manage
steps:
- name: Check out code
uses: actions/checkout@v2
with:
submodules: true
- name: Read version
id: readversion
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" |
docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: Build and push image
run: |
DOCKER_REPO=ghcr.io/${{ github.repository }}
# Change all uppercase to lowercase
DOCKER_REPO=$(echo $DOCKER_REPO | tr '[A-Z]' '[a-z]')
# Build and push with tag determined by build.sh
./dev/docker/build.sh -D $DOCKER_REPO ${{ matrix.service.name }}
docker push $(./dev/docker/build.sh -D $DOCKER_REPO --images ${{ matrix.service.name }})
# Build and push with tag 'latest' (when on stable branch)
case "$(git rev-parse --abbrev-ref HEAD)" in stable/4*)
./dev/docker/build.sh -D $DOCKER_REPO -t latest ${{ matrix.service.name }}
docker push $(./dev/docker/build.sh -D $DOCKER_REPO -t latest --images ${{ matrix.service.name }})
esac
dispatch-build-manage-tool:
runs-on: ubuntu-latest
if: startsWith(github.ref_name, 'stable/4')
needs: build
steps:
- name: Generate access token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
- name: Send dispatch to openslides-manage
uses: peter-evans/repository-dispatch@v2
with:
event-type: stable-update
repository: ${{ github.repository_owner }}/openslides-manage-service
token: ${{ steps.generate-token.outputs.token }}
client-payload: '{"branch": "${{ github.ref_name }}", "version": "${{ needs.build.outputs.openslides-version }}"}'