Skip to content

Merge pull request #8 from Access-Labs-Inc/fix/confirmation-flow-and-… #9

Merge pull request #8 from Access-Labs-Inc/fix/confirmation-flow-and-…

Merge pull request #8 from Access-Labs-Inc/fix/confirmation-flow-and-… #9

name: Release to production
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
release:
if: ${{ !endsWith(github.ref, '-beta') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- run: yarn install --immutable --immutable-cache --check-cache
- run: yarn run build-production-release
- run: zip -j widget dist/* README.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./widget.zip
asset_name: widget.zip
asset_content_type: application/zip
- name: S3 Upload
uses: jakejarvis/s3-sync-action@master
with:
args: --follow-symlinks --delete
env:
SOURCE_DIR: "./dist"
DEST_DIR: "acs-widget-actions"
AWS_REGION: ${{ secrets.AWS_S3_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# TODO: Move to federated OpenID concept instead: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
- name: Invalidate CDN
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION }}
# TODO: Update only updated files w example: https://github.com/chetan/invalidate-cloudfront-action
PATHS: "/acs-widget-actions/*"
AWS_REGION: ${{ secrets.AWS_S3_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}