v0.2.1 #73
Workflow file for this run
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: Node.js CI | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
release: | |
types: [ released ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- run: yarn install | |
- run: yarn build --if-present | |
- run: npx prettier --check src/ | |
- run: npx eslint src/ | |
# - run: yarn ci | |
- run: yarn test | |
release: | |
if: github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'released') | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'yarn' | |
- run: yarn install | |
- name: Build Staging React App | |
if: github.ref == 'refs/heads/main' | |
run: yarn build | |
env: | |
REACT_APP_CONFIG_SERVICE_URL: "https://safe-config.staging.5afe.dev" | |
REACT_APP_SHOW_CONFIG_SERVICE_SELECTOR: "true" | |
- name: Build Production React App | |
if: (github.event_name == 'release' && github.event.action == 'released') | |
run: yarn build | |
env: | |
REACT_APP_CONFIG_SERVICE_URL: "https://safe-config.safe.global" | |
REACT_APP_SHOW_CONFIG_SERVICE_SELECTOR: "false" | |
- name: Deploy to Staging S3 bucket | |
if: github.ref == 'refs/heads/main' | |
run: aws s3 sync ./build/ "s3://$BUCKET_NAME/current" --delete | |
env: | |
BUCKET_NAME: ${{ secrets.AWS_STAGING_BUCKET_NAME }} | |
- name: Upload release build files for production | |
if: (github.event_name == 'release' && github.event.action == 'released') | |
run: aws s3 sync ./build/ "s3://$BUCKET_NAME/releases/$VERSION" --delete | |
env: | |
BUCKET_NAME: ${{ secrets.AWS_STAGING_BUCKET_NAME }} | |
VERSION: ${{ github.event.release.tag_name }} | |
- name: Call script to prepare production deployments | |
if: (github.event_name == 'release' && github.event.action == 'released') | |
run: bash ./scripts/github/prepare_production_deployment.sh | |
env: | |
PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} | |
PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} | |
VERSION_TAG: ${{ github.event.release.tag_name }} |