forked from indico/indico-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (136 loc) Β· 4.92 KB
/
release.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Docker build & release
on:
push:
tags: ['v*']
jobs:
build:
name: Build Docker image
runs-on: ubuntu-22.04
steps:
- uses: docker/[email protected]
- uses: actions/checkout@v3
- name: Get version
id: version
run: |
echo indico_version="${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
echo indico_version="${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker π
id: meta
uses: docker/[email protected]
with:
images: |
ghcr.io/indico/indico
getindico/indico
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.indico_version }}
type=semver,pattern={{major}}.{{minor}}.x,value=${{ steps.version.outputs.indico_version }}
- name: Build Docker image π’
uses: docker/[email protected]
with:
context: indico-prod/worker
build-args: tag=${{ steps.version.outputs.indico_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/indico-image.tar
- name: Test if Indico works π§ͺ
run: |
docker load --input /tmp/indico-image.tar
# cp indico.env.sample indico.env
# sed -i -E 's/image: getindico\/indico:latest/image: getindico\/indico:${indico_version}/' docker-compose.yml
./test.sh
# XXX Using the cache as a hack to workaround extremely slow artifact uploads (5 minutes+ for less than 1GB)
- name: Get unique run id
id: unique_id
run: |
echo "cache_key=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Upload build artifact πΌ
uses: actions/cache@v3
with:
key: indico-image-${{ steps.unique_id.outputs.cache_key }}
path: /tmp/indico-image.tar
# - name: Upload build artifact πΌ
# uses: actions/upload-artifact@v3
# with:
# name: indico-image
# retention-days: 1
# path: /tmp/indico-image.tar
publish-ghcr:
name: Publish to GHCR π
needs: build
runs-on: ubuntu-22.04
environment: publish-ghcr
permissions:
packages: write
steps:
# - name: Download build artifact π½
# uses: actions/download-artifact@v3
# with:
# name: indico-image
# path: /tmp/
# XXX Using the cache as a hack to workaround extremely slow artifact uploads (5 minutes+ for less than 1GB)
- name: Get unique run id
id: unique_id
run: |
echo "cache_key=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Download build artifact π½
uses: actions/cache@v3
with:
key: indico-image-${{ steps.unique_id.outputs.cache_key }}
path: /tmp/indico-image.tar
- name: Import image
run: |
docker load --input /tmp/indico-image.tar
docker image ls -a | grep indico
- name: Log in to GHCR π
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push Docker image π’
run: |
OWNER=${GITHUB_REPOSITORY%/*}
docker push --all-tags ghcr.io/${OWNER}/indico
# - name: Delete build artifact π
# if: success() || failure()
# uses: geekyeggo/delete-artifact@v2
# with:
# name: indico-image
publish-dockerhub:
name: Publish to Docker Hub π’
needs: build
runs-on: ubuntu-22.04
environment: publish-dockerhub
steps:
# - name: Download build artifact π½
# uses: actions/download-artifact@v3
# with:
# name: indico-image
# path: /tmp/
# XXX Using the cache as a hack to workaround extremely slow artifact uploads (5 minutes+ for less than 1GB)
- name: Get unique run id
id: unique_id
run: |
echo "cache_key=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Download build artifact π½
uses: actions/cache@v3
with:
key: indico-image-${{ steps.unique_id.outputs.cache_key }}
path: /tmp/indico-image.tar
- name: Import image
run: |
docker load --input /tmp/indico-image.tar
docker image ls -a | grep indico
- name: Log in to Docker Hub π
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push Docker image π’
run: |
docker push --all-tags getindico/indico
# - name: Delete build artifact π
# if: success() || failure()
# uses: geekyeggo/delete-artifact@v2
# with:
# name: indico-image