Skip to content

[ENHANCEMENT] [MER-3503] Add support for accessing research consent form #2962

[ENHANCEMENT] [MER-3503] Add support for accessing research consent form

[ENHANCEMENT] [MER-3503] Add support for accessing research consent form #2962

Workflow file for this run

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 }}
check-auto-deploy:
name: Check AUTO_DEPLOY_ENABLED config
runs-on: ubuntu-latest
environment: tokamak.oli.cmu.edu
outputs:
enabled: ${{ steps.check_auto_deploy_enabled.outputs.enabled }}
auto_deploy_ref: ${{ steps.get_auto_deploy_ref.outputs.auto_deploy_ref }}
steps:
- name: Check whether AUTO_DEPLOY_ENABLED is set to TRUE
id: check_auto_deploy_enabled
run: echo "enabled=$(if [ "${{ vars.AUTO_DEPLOY_ENABLED }}" == "TRUE" ] ; then echo true ; else echo false ; fi)" >> $GITHUB_OUTPUT
- name: Get AUTO_DEPLOY_REF config
id: get_auto_deploy_ref
run: echo "auto_deploy_ref=$(if [ -n "${{ vars.AUTO_DEPLOY_REF }}" ] ; then echo ${{ vars.AUTO_DEPLOY_REF }} ; else echo refs/heads/master ; fi)" >> $GITHUB_OUTPUT
deployment:
runs-on: ubuntu-latest
environment: tokamak.oli.cmu.edu
needs: [amazon-linux, check-auto-deploy]
if: github.ref == needs.check-auto-deploy.outputs.auto_deploy_ref && needs.check-auto-deploy.outputs.enabled == 'true'
steps:
- run: echo "deploying ${{ github.sha }} ${{ github.ref }} ${{ github.ref_name }} to tokamak.oli.cmu.edu"
- name: 🚢💰 Deploy to test using SSH
uses: fifsky/ssh-action@master
with:
command: |
cd /torus
sh deploy.sh -r ${{ github.ref }} ${{ needs.amazon-linux.outputs.app_version }} ${{ needs.amazon-linux.outputs.sha_short }}
host: tokamak.oli.cmu.edu
user: simon-bot
key: ${{ secrets.SIMON_BOT_PRIVATE_KEY}}
port: 44067