-
Notifications
You must be signed in to change notification settings - Fork 43
executable file
·284 lines (267 loc) · 12 KB
/
release.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Maybe release
on:
push:
branches:
- main
jobs:
docker:
strategy:
matrix:
flavour: ["classic"] # , "cooperation"]
platforms: ["linux/amd64", "linux/arm/v7,linux/arm64,linux/amd64"] # , "linux/arm64"
include:
- platforms: "linux/amd64"
tag_extra: "-amd64"
name: ${{ matrix.flavour }} - Docker on ${{ matrix.platforms }}
runs-on: ubuntu-latest
permissions: write-all
env:
FLAVOUR: ${{ matrix.flavour }}
DOCKER_REPO: bonfire
steps:
-
name: Cancel any already running releases workflows
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2 # needed for action-detect-and-tag-new-version
-
name: Detect version
id: version
uses: salsify/action-detect-and-tag-new-version@v2
with:
create-tag: false # tag already created in other job
version-command: |
grep -m 1 'version:' mix.exs | cut -d '"' -f2
# -
# name: Get branch names
# id: branch-name
# uses: tj-actions/branch-names@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Pre-build prep
run: sudo apt-get install -y cargo && cargo install just && echo "/github/home/.cargo/bin" >> $GITHUB_PATH && just rel-prepare
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
env:
FLAVOUR_PATH: data/current_flavour
with:
context: .
file: Dockerfile.release
platforms: ${{ matrix.platforms }}
push: true
tags: |
bonfirenetworks/${{ env.DOCKER_REPO }}:latest-${{ env.FLAVOUR }}${{ matrix.tag_extra }}
bonfirenetworks/${{ env.DOCKER_REPO }}:${{steps.version.outputs.current-version}}-${{ env.FLAVOUR }}${{ matrix.tag_extra }}
ghcr.io/bonfire-networks/bonfire-app:latest-${{ env.FLAVOUR }}${{ matrix.tag_extra }}
ghcr.io/bonfire-networks/bonfire-app:${{steps.version.outputs.current-version}}-${{ env.FLAVOUR }}${{ matrix.tag_extra }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
# elixir_release:
# name: ${{ matrix.flavour }} - OTP on amd64 bullseye
# strategy:
# matrix:
# flavour: ["classic"] # , "cooperation"]
# runs-on: ubuntu-latest
# container: debian:bullseye-slim
# env:
# FLAVOUR: ${{ matrix.flavour }}
# WITH_DOCKER: no
# MIX_ENV: prod
# TERM: linux
# steps:
# -
# name: Cancel any already running releases workflows
# uses: styfle/[email protected]
# with:
# access_token: ${{ github.token }}
# - name: Install git # needed for checkout with fetch-depth
# run: apt-get update -q -y && apt-get install -q -y git
# - uses: actions/checkout@v2
# with:
# fetch-depth: 2 # needed for action-detect-and-tag-new-version
# - name: Trust my repo
# run: export GIT_CEILING_DIRECTORIES=/__w && git config --global --add safe.directory $(realpath .) # see https://github.com/actions/checkout/issues/760
# -
# name: Maybe tag/release new version
# id: version
# uses: salsify/action-detect-and-tag-new-version@v2
# with:
# version-command: grep -m 1 'version:' mix.exs | cut -d '"' -f2
# -
# if: steps.version.outputs.current-version == steps.version.outputs.previous-version
# name: Cancel workflow if the version has not changed
# uses: andymckay/[email protected]
# -
# name: Install deps & build app
# run: |
# chmod +x deps-debian.sh && ./deps-debian.sh
# . /opt/asdf/asdf.sh
# mix local.hex --force
# mix local.rebar --force
# just config
# just mix "deps.get --only prod"
# just rel-build
# cd _build/prod/rel && tar -czvf bonfire-${{ env.FLAVOUR }}-amd64-debian-bullseye.tar.gz bonfire
# - name: Release to github
# uses: softprops/action-gh-release@v1
# with:
# files: _build/prod/rel/bonfire-*.tar.gz
# name: Unstable - ${{ steps.version.outputs.tag }}
# tag_name: ${{ steps.version.outputs.tag }}
# # - name: Publish release
# # uses: mayel/actions/bin/ghr@master
# # env:
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # RELEASE_PATH: _build/prod/rel
# # CI: 1
# - name: Create tags in extensions repos
# uses: bonfire-networks/[email protected]
# with:
# version: ${{ steps.version.outputs.current-version }}
# message: ${{ github.event.inputs.message }}
# token: ${{ secrets.GH_TOKEN }}
# owner: "bonfire-networks"
# repos: "bonfire_api_graphql,bonfire_data_identity,bonfire_fail,bonfire_ui_me,bonfire_boundaries,bonfire_data_shared_user,bonfire_federate_activitypub,bonfire_quantify,bonfire_breadpub,bonfire_data_social,bonfire_files,bonfire_recyclapp,bonfire_ui_social,bonfire_classify,bonfire_geolocate,bonfire_search,bonfire_ui_valueflows,bonfire_common,bonfire_ecto,bonfire_invite_links,bonfire_social,bonfire_data_access_control,bonfire_editor_ck,bonfire_livebook,bonfire_tag,bonfire_valueflows,bonfire_data_activity_pub,bonfire_editor_quill,bonfire_mailer,bonfire_valueflows_api_schema,bonfire_data_assort,bonfire_me,bonfire_ui_common,bonfire_valueflows_observe,bonfire_epics,bonfire_notify,bonfire_ui_coordination,bonfire_data_edges,bonfire_extension_template,bonfire_open_id,bonfire_ui_kanban"
# # bonfire_upcycle,bonfire_publisher_thesis,bonfire_ui_reflow,bonfire_data_tasks,bonfire_taxonomy_seeder,bonfire_encryption_backend,bonfire_pages,bonfire_web_phoenix,bonfire_website
# elixir_release_extra_architectures:
# # The host should always be linux
# runs-on: ubuntu-latest
# name: ${{ matrix.flavour }} - OTP on ${{ matrix.arch }} ${{ matrix.distro }}
# # Run steps on a matrix of several arch/distro combinations
# strategy:
# matrix:
# flavour: ["classic"] # , "cooperation"]
# arch: ["aarch64", "armv7"]
# distro: ["bullseye"]
# include:
# - arch: aarch64
# family: debian
# distro: bullseye
# # base_image: elixir:1.14-slim
# - arch: armv7
# family: debian
# distro: bullseye
# # base_image: elixir:1.14-slim
# # - arch: aarch64
# # distro: alpine_latest
# # - arch: none
# # distro: none
# # base_image: debian:bullseye-slim # Error: run-on-arch: If arch and distro are not specified, base_image is required
# # family: debian
# # arch_alt: amd64
# # distro_alt: bullseye
# env:
# FLAVOUR: ${{ matrix.flavour }}
# WITH_DOCKER: no
# MIX_ENV: prod
# TERM: linux
# steps:
# -
# name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 2 # needed for action-detect-and-tag-new-version
# -
# name: Detect version
# id: version
# uses: salsify/action-detect-and-tag-new-version@v2
# with:
# create-tag: false # tag already created in other job
# version-command: |
# grep -m 1 'version:' mix.exs | cut -d '"' -f2
# - uses: uraimo/[email protected]
# name: Build artifact
# id: build
# with:
# arch: ${{ matrix.arch }}
# distro: ${{ matrix.distro }}
# # Not required, but speeds up builds
# githubToken: ${{ github.token }}
# # Create an artifacts directory
# setup: |
# mkdir -p "${PWD}/artifacts"
# # cp .tool-versions "${PWD}/artifacts/"
# # Mount the artifacts directory as /artifacts in the container
# dockerRunArgs: |
# --volume "${PWD}/artifacts:/artifacts"
# # Pass some environment variables to the container
# env: | # YAML, but pipe character is necessary
# artifact_name: bonfire-${{ env.FLAVOUR }}-${{ matrix.arch || matrix.arch_alt }}-${{ matrix.family }}-${{ matrix.distro || matrix.distro_alt }}.tar.gz
# # The shell to run commands with in the container
# shell: /bin/bash
# # Install some dependencies in the container. This speeds up builds if
# # you are also using githubToken. Any dependencies installed here will
# # be part of the container image that gets cached, so subsequent
# # builds don't have to re-install them. The image layer is cached
# # publicly in your project's package repository, so it is vital that
# # no secrets are present in the container state or logs.
# install: |
# export TERM=${{ env.TERM }}
# case "${{ matrix.distro }}" in
# ubuntu*|jessie|stretch|buster|bullseye)
# # chmod +x deps-debian.sh && ./deps-debian.sh
# # have to copy paste because the script ^ is not available in container:
# asdf_dir=/opt/asdf
# mkdir -p $asdf_dir
# apt-get update -q -y
# apt-get install -q -y --no-install-recommends git tar file gcc sqlite3 npm mailcap ca-certificates libssl-dev tzdata gettext curl rustc cargo wget gnupg sudo unzip
# git clone https://github.com/asdf-vm/asdf.git $asdf_dir --branch v0.11.1
# . "$asdf_dir/asdf.sh"
# asdf plugin-add erlang && asdf plugin-add elixir && asdf plugin-add just
# # Install
# apt-get install -q -y --no-install-recommends autoconf dpkg-dev gcc g++ make libncurses-dev unixodbc-dev libssl-dev libsctp-dev libodbc1 libssl1.1 libsctp1
# # TODO: use .tool-versions instead of latest
# which erl || (asdf install erlang latest && asdf global erlang latest)
# elixir -v || (asdf install elixir latest && asdf global elixir latest) #|| apt-get install -y elixir
# just --version || (asdf install just latest && asdf global just latest) || cargo install just #|| apt-get install -y just
# npm install --global yarn
# echo $PATH
# ls -la $asdf_dir && ls -la $asdf_dir/bin && /github/home/.asdf/shims
# elixir -v
# just --version
# yarn -v
# ;;
# alpine*)
# chmod +x deps-alpine.sh && ./deps-alpine.sh
# ;;
# esac
# mix local.hex --force
# mix local.rebar --force
# # Produce a binary artifact and place it in the mounted volume
# run: |
# . "/opt/asdf/asdf.sh"
# just config
# just mix "deps.get --only prod"
# just rel-build
# cd _build/prod/rel && tar -czvf /artifacts/${artifact_name} bonfire
# echo "Produced artifact at /artifacts/${artifact_name}"
# - name: List the artifacts
# # Items placed in /artifacts in the container will be in
# # ${PWD}/artifacts on the host.
# run: |
# ls -al "${PWD}/artifacts"
# - name: Release to github
# uses: softprops/action-gh-release@v1
# with:
# files: "${PWD}/artifacts/*"
# name: Unstable - ${{ steps.version.outputs.tag }}
# tag_name: ${{ steps.version.outputs.tag }}