ライブラリのバージョンアップ #75
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: CI/CD for nautible front app | |
on: | |
push: | |
branches: ['develop', 'feature/*', 'hotfix/*'] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: develop # for azure oidc | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ./app/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# AWS | |
- name: setup env file for aws | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
sed -e "s/\$domain/${{ secrets.AWS_CLOUDFRONT_DOMAIN }}/" .env.auth-sample > .env | |
- name: Build for aws | |
env: | |
CI: false | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
yarn | |
yarn build | |
- name: Test for aws | |
env: | |
CI: false | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
yarn test | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/nautible-dev-githubactions-static-web-deploy-role | |
aws-region: ap-northeast-1 | |
- name: deploy to aws s3 | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
aws s3 sync ./build s3://${{ secrets.AWS_S3_STATIC_WEB_BUCKET }} --exclude "*.git/*" --delete | |
# Azure | |
- name: setup env file for azure | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
sed -e "s/\$domain/${{ secrets.AZURE_FRONTDOOR_DOMAIN }}/" .env.auth-sample > .env | |
- name: Build for azure | |
env: | |
CI: false | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
yarn | |
yarn build | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: deploy to azure storage account | |
run: | | |
cd $GITHUB_WORKSPACE/app | |
az storage blob upload-batch --account-name nautibledevstaticweb -d '$web' -s ./build --overwrite=True |