deploy_development #5
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: deploy_development | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version number' | |
required: true | |
default: '' | |
type: string | |
env: | |
MAJORVERSION: '' | |
COMPONENT_NAME: 'ilw-back-to-top' # set this to the web component name you are using | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@v4 | |
- name: Get version from input | |
run: echo "VERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV | |
env: | |
GITHUB_BRANCH: ${{ github.event.inputs.version }} | |
- name: Display version install | |
run: echo "Installing dev version ${VERSION}" | |
- run: npm install | |
- run: npm rebuild | |
- run: npm run-script build | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }} | |
aws-region: us-east-2 | |
- name: Deploy toolbox to S3 bucket | |
run: aws s3 sync ./dist/ s3://dev.toolkit.illinois.edu/content/$COMPONENT_NAME/$VERSION --delete --acl bucket-owner-full-control | |
- name: Invalidate Cloudfront cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME/$VERSION*" |