Skip to content

Github Actions S3 Deploy (Self-hosted) #626

Github Actions S3 Deploy (Self-hosted)

Github Actions S3 Deploy (Self-hosted) #626

Workflow file for this run

name: Github Actions S3 Deploy (Self-hosted)
env:
AWS_REGION_NAME : "us-east-2"
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION : true
# Controls when the action will run.
on:
schedule:
- cron: '0 14 * * SUN,MON,TUE' # every Monday and Tuesday at 10amET
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest-2404-32core-128mem
# Time out after 24 hours.
timeout-minutes: 1440
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Change dir owner to working user
run: sudo chown -R $USER:$USER $GITHUB_WORKSPACE
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Test AWS cli installation
run: aws --version
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ env.AWS_REGION_NAME }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: cmu-delphi-deploy-machine
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}
- name: Deploy score files to S3 bucket
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
make deploy
- name: Cleanup
if: ${{ always() }}
run: |
docker image prune -a -f
docker container prune -f
docker ps -q | xargs -n 1 -P 8 -I {} docker stop {}