-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 2.16 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
name: Publish a release file/version to AWS
on:
push:
branches:
- main
env:
MIX_ENV: prod
jobs:
build:
name: Building Calori release and publishing it at AWS
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup BEAM
uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- name: Capture GITHUB_SHORT_SHA
run: |
GITHUB_SHORT_SHA=$(git rev-parse --short ${{ github.sha }})
echo "GITHUB_SHORT_SHA=${GITHUB_SHORT_SHA}" >> $GITHUB_ENV
- name: Capture and update project mix version
run: |
MIX_VERSION=`grep "version:" mix.exs | awk -F'"' '{print $2}'`
CALORI_VERSION=${MIX_VERSION}-${GITHUB_SHORT_SHA}
echo "CALORI_VERSION=${CALORI_VERSION}" >> $GITHUB_ENV
sed -i "s/.*version:.*/ version: \"${CALORI_VERSION}\",/" mix.exs
- name: Create Release file version
run: |
echo "{\"version\":\"${CALORI_VERSION}\",\"hash\":\"${GITHUB_SHA}\"}" | jq > current.json
- name: Install Elixir dependencies
run: mix do deps.get, compile
- name: Assets Deploy
run: mix assets.deploy
- name: Generate a Release
run: mix release
- name: Copy a release file to the s3 distribution folder
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: "sa-east-1"
source: '_build/prod/*.tar.gz'
dest: 's3://calori-${{ secrets.CLOUD_ENV_NAME }}-distribution/dist/calori/calori-${CALORI_VERSION}.tar.gz'
- name: Copy a version file to the s3 version folder
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: "sa-east-1"
source: 'current.json'
dest: 's3://calori-${{ secrets.CLOUD_ENV_NAME }}-distribution/versions/calori/${{ secrets.CLOUD_ENV_NAME }}/current.json'