Fix formatting #211
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: Build | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Setup | |
run: | | |
npm install -g @angular/cli | |
npm ci --legacy-peer-deps | |
env: | |
CI: true | |
- name: Build | |
if: github.ref != 'refs/heads/staging' && github.ref != 'refs/heads/prod' | |
run: ng build | |
env: | |
NODE_OPTIONS: --openssl-legacy-provider | |
- name: Build for staging | |
if: github.ref == 'refs/heads/staging' | |
run: ng build --configuration=staging | |
env: | |
NODE_OPTIONS: --openssl-legacy-provider | |
- name: Configure AWS credentials for staging | |
if: github.ref == 'refs/heads/staging' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy to staging | |
if: github.ref == 'refs/heads/staging' | |
run: | | |
aws s3 sync dist/ s3://events.worldskills.show --exclude index.html --cache-control max-age=31536000 | |
aws s3 cp dist/index.html s3://events.worldskills.show/index.html --metadata-directive REPLACE --cache-control max-age=60 | |
- name: Invalidate staging | |
if: github.ref == 'refs/heads/staging' | |
run: aws cloudfront create-invalidation --distribution-id E3VOFUYQ7T40H8 --paths /index.html /assets/i18n/* | |
- name: Build for production | |
if: github.ref == 'refs/heads/prod' | |
run: ng build --configuration=prod | |
env: | |
NODE_OPTIONS: --openssl-legacy-provider | |
- name: Configure AWS credentials for production | |
if: github.ref == 'refs/heads/prod' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy to production | |
if: github.ref == 'refs/heads/prod' | |
run: | | |
aws s3 sync dist/ s3://events.worldskills.org --exclude index.html --cache-control max-age=31536000 | |
aws s3 cp dist/index.html s3://events.worldskills.org/index.html --metadata-directive REPLACE --cache-control max-age=60 | |
- name: Invalidate production | |
if: github.ref == 'refs/heads/prod' | |
run: aws cloudfront create-invalidation --distribution-id EW0W81GM2S4NZ --paths /index.html /assets/i18n/* |