[FEATURE] [MER-3883] Implement outline metrics (#5261) #3303
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package | |
on: | |
push: | |
branches: | |
- master | |
- hotfix-* | |
- prerelease-* | |
- nextgen-ux | |
# manually trigger a package build from the Actions tab | |
workflow_dispatch: | |
jobs: | |
amazon-linux: | |
runs-on: ubuntu-latest | |
outputs: | |
app_version: ${{ steps.info.outputs.app_version }} | |
sha_short: ${{ steps.info.outputs.sha_short }} | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v2 | |
- name: 🧾 Build info | |
id: info | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "app_version=$(cat mix.exs | grep version | sed -e 's/.*version: "\(.*\)",/\1/')" >> $GITHUB_OUTPUT | |
echo "workspace=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# build (or retrieve from cache) the amazon-linux-builder image, used by the next step to build the release for Amazon Linux 2 | |
- name: 🐳 Build amazon-linux-builder image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./.github/actions/amazon-linux-builder | |
load: true | |
push: false | |
tags: amazon-linux-builder:local | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: 📦 Package for Amazon Linux | |
uses: ./.github/actions/amazon-linux-builder | |
with: | |
build-sha: ${{ steps.info.outputs.sha_short }} | |
- name: 🗜️ Zip it | |
run: | | |
mkdir oli-torus-releases | |
cd _build/prod/rel/oli | |
zip -r ../../../../oli-torus-releases/oli-${{ steps.info.outputs.app_version }}-${{ steps.info.outputs.sha_short }}.zip * | |
- name: ⬆️💽 Upload release to S3 archive | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks | |
env: | |
AWS_S3_BUCKET: "oli-torus-releases" | |
AWS_ACCESS_KEY_ID: ${{ secrets.SIMON_BOT_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIMON_BOT_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-east-2" | |
SOURCE_DIR: "oli-torus-releases" | |
container: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
app_version: ${{ steps.info.outputs.app_version }} | |
sha_short: ${{ steps.info.outputs.sha_short }} | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v3 | |
- name: 🔧 Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: 🧾 Build info | |
id: info | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "app_version=$(cat mix.exs | grep version | sed -e 's/.*version: "\(.*\)",/\1/')" >> $GITHUB_OUTPUT | |
- name: 🧾 Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/simon-initiative/oli-torus | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: 🔑 Log in to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# builds the official oli-torus app image | |
- name: 🐳 Docker Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
build-args: APP_VERSION=${{ steps.info.outputs.app_version }} | |
SHA_SHORT=${{ steps.info.outputs.sha_short }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |