Skip to content

Merge pull request #1 from thiagoesteves/thi/add-default-home-supervisor #14

Merge pull request #1 from thiagoesteves/thi/add-default-home-supervisor

Merge pull request #1 from thiagoesteves/thi/add-default-home-supervisor #14

Workflow file for this run

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'