-
Notifications
You must be signed in to change notification settings - Fork 8
248 lines (243 loc) · 8.76 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
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
name: Release
on:
push:
tags:
- '*'
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.upload_url }}
steps:
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ endsWith(github.ref, '-pre') }}
release-ubuntu:
needs: [create_release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set output
id: vars
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Install OTP and Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 24.3.4
elixir-version: 1.14.2
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.12.1
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get --only prod
- name: Compile Web Assets
run: |
yarn install --cwd assets
mix assets.deploy
env:
MIX_ENV: prod
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
- name: mix release
run: |
mix release
env:
MIX_ENV: prod
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
- name: Compress files
uses: master-atul/tar-action@v1.1.2
with:
command: c
cwd: ./_build/prod/rel
files: |
./open890
outPath: /tmp/open890-${{ steps.vars.outputs.TAG }}-ubuntu-x64.tar.gz
- name: Upload Release Asset
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /tmp/open890-${{ steps.vars.outputs.TAG }}-ubuntu-x64.tar.gz
asset_name: open890-${{ steps.vars.outputs.TAG }}-ubuntu-x64.tar.gz
tag: ${{ steps.vars.outputs.tag }}
- name: Upload Release Asset to S3
id: upload-release-asset-s3
run: |
aws s3 cp /tmp/open890-${{ steps.vars.outputs.TAG }}-ubuntu-x64.tar.gz s3://${{ secrets.AWS_S3_BUCKET }}/${{ secrets.AWS_S3_BUCKET_PATH }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }}
AWS_EC2_METADATA_DISABLED: true
#release-macos:
# needs: [create_release]
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# with:
# ref: ${{ github.head_ref }}
# - name: Set output
# id: vars
# run: |
# echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
# cat $GITHUB_OUTPUT
# - name: Install asdf via homebrew
# run: |
# brew install asdf coreutils automake autoconf libyaml readline libxslt libtool
# brew install openssl@1.1
# mkdir -p ~/.asdf/installs/erlang
# - name: Show openssl prefix
# run: |
# brew --prefix openssl@1.1
# - name: Action-cache asdf erlang build
# uses: actions/cache@v3
# with:
# path: ~/.asdf/installs/erlang
# key: ${{ runner.os }}-${{ hashFiles('.tool-versions') }}
# - name: Install OTP and Elixir via asdf
# env:
# KERL_CONFIGURE_OPTIONS: "--disable-dynamic-ssl-lib --without-javac --with-ssl=/usr/local/opt/openssl@1.1"
# run: |
# make install_tools
# asdf reshim erlang
# # - name: Cache asdf Erlang build to S3
# # run: |
# # cd ~/.asdf/installs/erlang && tar zcvf /tmp/asdf-erlang-install-macos.tar.gz ~/.asdf/installs/erlang/
# # aws s3 cp /tmp/asdf-erlang-install-macos.tar.gz s3://${{ secrets.AWS_S3_BUCKET }}/build_tmp/
# # env:
# # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# # AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }}
# # AWS_EC2_METADATA_DISABLED: true
# - name: Install Dependencies
# if: steps.mix-cache.outputs.cache-hit != 'true'
# run: |
# export PATH=~/.asdf/shims:$PATH
# mix local.rebar --force
# mix local.hex --force
# mix deps.get --only prod
# - name: Compile Web Assets
# run: |
# export PATH=~/.asdf/shims:$PATH
# yarn install --cwd assets
# mix assets.deploy
# env:
# MIX_ENV: prod
# SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
# - name: mix release
# run: |
# export PATH=~/.asdf/shims:$PATH
# mix release
# env:
# MIX_ENV: prod
# SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
# - name: Compress files
# uses: master-atul/tar-action@v1.1.2
# with:
# command: c
# cwd: ./_build/prod/rel
# files: |
# ./open890
# outPath: /tmp/open890-${{ steps.vars.outputs.TAG }}-macos-intel.tar.gz
# - name: Output release checksum
# run: |
# echo "::set-output name=sha256_linux::$(sha256sum /tmp/open890-${{ steps.vars.outputs.TAG }}-macos-intel.tar.gz)"
# - name: Upload Release Asset
# id: upload-release-asset
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: /tmp/open890-${{ steps.vars.outputs.TAG }}-macos-intel.tar.gz
# asset_name: open890-${{ steps.vars.outputs.TAG }}-macos-intel.tar.gz
# tag: ${{ steps.vars.outputs.TAG }}
# - name: Upload Release Asset to S3
# id: upload-release-asset-s3
# run: |
# aws s3 cp /tmp/open890-${{ steps.vars.outputs.TAG }}-macos-intel.tar.gz s3://${{ secrets.AWS_S3_BUCKET }}/${{ secrets.AWS_S3_BUCKET_PATH }}
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }}
# AWS_EC2_METADATA_DISABLED: true
release-windows:
needs: [create_release]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set output
shell: bash
id: vars
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Install Erlang and Elixir
env:
ERLANG_VERSION: 24.3.4
ELIXIR_VERSION: 1.14.2
run: |
build_scripts\win64\install_elixir.ps1;
echo "c:\erlang\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append;
echo "c:\elixir\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append;
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get --only prod
- name: Install node dependencies
working-directory: assets
run: |
yarn install --cwd assets
env:
MIX_ENV: prod
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
- name: mix assets.deploy.windows
run: |
mix assets.deploy.windows
env:
MIX_ENV: prod
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
- name: mix release
run: |
mix release
env:
MIX_ENV: prod
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
- name: Compress files
run: |
cd _build\prod\rel
7z a ..\..\..\open890-${{ steps.vars.outputs.TAG }}-windows-x64.zip open890\
cd ..\..\..
- name: Upload Release Asset
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: open890-${{ steps.vars.outputs.TAG }}-windows-x64.zip
asset_name: open890-${{ steps.vars.outputs.TAG }}-windows-x64.zip
tag: ${{ steps.vars.outputs.TAG }}
- name: Upload Release Asset to S3
id: upload-release-asset-s3
run: |
aws s3 cp open890-${{ steps.vars.outputs.TAG }}-windows-x64.zip s3://${{ secrets.AWS_S3_BUCKET }}/${{ secrets.AWS_S3_BUCKET_PATH }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_S3_REGION }}
AWS_EC2_METADATA_DISABLED: true