fix(e2e): fix e2e publish button disable error #2060
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: Deployment | |
on: | |
pull_request: | |
branches: | |
- master | |
- develop | |
types: [closed] | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
jobs: | |
build_and_deploy: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@master | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.14' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm ci | |
- name: Generate Types (develop) | |
if: github.base_ref == 'develop' | |
run: npm run gen:type | |
- name: Generate Types (production) | |
if: github.base_ref == 'master' | |
run: npm run gen:type:prod | |
- name: Lint | |
run: | | |
npm run i18n \ | |
&& npm run lint \ | |
&& npm run format:check | |
# - name: Test | |
# run: npm install codecov -g && npm run test && codecov | |
# env: | |
# CODECOV_TOKEN: f109cbf6-b6c7-4a08-ad03-981bc4cd1fe8 | |
# MATTERS_ENV: test | |
# API_URL: http://matters-server-develop.ap-southeast-1.elasticbeanstalk.com/graphql | |
# - name: Test - BDD | |
# === `develop` branch === | |
- name: Build (develop) | |
if: github.base_ref == 'develop' | |
run: cp .env.dev .env.local && npm run build | |
# === `master` branch === | |
- name: Build (production) | |
if: github.base_ref == 'master' | |
run: cp .env.prod .env.local && npm run build | |
- name: Setup AWS | |
if: github.base_ref == 'develop' || github.base_ref == 'master' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-southeast-1 | |
- name: Generate deployment package | |
if: github.base_ref == 'develop' || github.base_ref == 'master' | |
run: | | |
rm -rf node_modules \ | |
&& npm install --production \ | |
&& zip -r --symlinks deploy.zip . -x .git/\* | |
- name: Upload Assets (develop - R2) | |
if: github.base_ref == 'develop' | |
uses: andreiio/rclone-action@v1 | |
env: | |
RCLONE_CONFIG_R2_TYPE: s3 | |
RCLONE_CONFIG_R2_PROVIDER: Cloudflare | |
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.RCLONE_CONFIG_R2_ACCESS_KEY_ID }} | |
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.RCLONE_CONFIG_R2_SECRET_ACCESS_KEY }} | |
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.RCLONE_CONFIG_R2_ENDPOINT }} | |
with: | |
args: sync .next/static r2:matters-assets-next-develop/_next/static -P | |
- name: Deploy to EB (develop) | |
if: github.base_ref == 'develop' | |
uses: einaregilsson/beanstalk-deploy@v19 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: matters-stage | |
environment_name: matters-client-develop | |
version_label: matters-web-develop-${{ hashFiles('deploy.zip') }} | |
version_description: ${{ github.SHA }} | |
region: ap-southeast-1 | |
deployment_package: deploy.zip | |
use_existing_version_if_available: true | |
wait_for_deployment: true | |
- name: Upload Assets (production - R2) | |
if: github.base_ref == 'master' | |
uses: andreiio/rclone-action@v1 | |
env: | |
RCLONE_CONFIG_R2_TYPE: s3 | |
RCLONE_CONFIG_R2_PROVIDER: Cloudflare | |
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.RCLONE_CONFIG_R2_ACCESS_KEY_ID }} | |
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.RCLONE_CONFIG_R2_SECRET_ACCESS_KEY }} | |
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.RCLONE_CONFIG_R2_ENDPOINT }} | |
with: | |
args: sync .next/static r2:matters-assets-next/_next/static -P | |
- name: Deploy to EB (production) | |
if: github.base_ref == 'master' | |
uses: einaregilsson/beanstalk-deploy@v19 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: matters-prod | |
environment_name: matters-client-prod | |
version_label: matters-web-prod-${{ hashFiles('deploy.zip') }} | |
version_description: ${{ github.SHA }} | |
region: ap-southeast-1 | |
deployment_package: deploy.zip | |
use_existing_version_if_available: true | |
wait_for_deployment: true | |
- name: Slack Notification | |
if: always() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
author_name: matters-web | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took |