Skip to content

2.1.4

2.1.4 #449

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
branches:
- '**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: latest
- name: Install Rust
run: |
rustup install stable
- name: Install wasm-pack
uses: taiki-e/install-action@wasm-pack
- name: Prepare cache
id: cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Build wasm
run: npm run build:wasm
- name: Build app
run: npm run build
- name: Test
run: npm test
- name: Lint
run: npm run lint
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
staging:
name: Staging
needs: build
runs-on: ubuntu-latest
environment:
name: ${{ github.event_name == 'pull_request' && 'Pull Request' || 'Staging' }}
url: ${{ steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Download production artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Deploy to Netlify
id: deploy
uses: netlify/actions/cli@master
with:
args: deploy --dir=dist
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
deploy:
name: Deploy
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment:
name: Production
url: https://mahjong-calc.livewing.net/
steps:
- name: Download production artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
role-session-name: GitHubActions
aws-region: ap-northeast-1
- name: Deploy to S3
run: aws s3 sync --exact-timestamp --delete dist/ ${{ secrets.AWS_S3_BUCKET_NAME }}
- name: Invalidate CloudFront cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths '/*'