Skip to content

Release Dev

Release Dev #166

Workflow file for this run

on:
workflow_run:
workflows:
- "Check Code Quality"
branches:
- main
types:
- completed
name: Release Dev
env:
S3_PATH: ${{ secrets.S3_PATH_DEV }}
AWS_REGION: ${{ secrets.AWS_REGION_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
AWS_STACK_ID: ${{ secrets.AWS_STACK_ID_DEV }}
AWS_LAYER_ID: ${{ secrets.AWS_LAYER_ID_DEV }}
AWS_APP_ID: ${{ secrets.AWS_APP_ID_DEV }}
NEXT_PRIVATE_BASE_URL: ${{ secrets.NEXT_PRIVATE_BASE_URL_DEV }}
NEXT_PRIVATE_DOMAIN: ${{ secrets.NEXT_PRIVATE_DOMAIN_DEV }}
NEXT_PRIVATE_PORT: ${{ secrets.NEXT_PRIVATE_PORT_DEV }}
NEXT_PRIVATE_REDIS_URL: ${{ secrets.NEXT_PRIVATE_REDIS_URL_DEV }}
NEXT_PRIVATE_MONGO_URL: ${{ secrets.NEXT_PRIVATE_MONGO_URL_DEV }}
NEXT_PRIVATE_IS_MONGO_DEBUG: ${{ secrets.NEXT_PRIVATE_IS_MONGO_DEBUG_DEV }}
NEXT_PRIVATE_ZEPLIN_URL: ${{ secrets.NEXT_PRIVATE_ZEPLIN_URL_DEV }}
NEXT_PRIVATE_ZEPLIN_CLIENT_ID: ${{ secrets.NEXT_PRIVATE_ZEPLIN_CLIENT_ID_DEV }}
NEXT_PRIVATE_ZEPLIN_CLIENT_SECRET: ${{ secrets.NEXT_PRIVATE_ZEPLIN_CLIENT_SECRET_DEV }}
NEXT_PRIVATE_WEBHOOK_SECRET: ${{ secrets.NEXT_PRIVATE_WEBHOOK_SECRET_DEV }}
NEXT_PRIVATE_MIXPANEL_TOKEN: ${{ secrets.NEXT_PRIVATE_MIXPANEL_TOKEN_DEV }}
NEXT_PRIVATE_IS_MIXPANEL_ENABLED: ${{ secrets.NEXT_PRIVATE_IS_MIXPANEL_ENABLED_DEV }}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN_DEV }}
NEXT_PUBLIC_IS_SENTRY_ENABLED: ${{ secrets.NEXT_PUBLIC_IS_SENTRY_ENABLED_DEV }}
NEXT_PUBLIC_ZEPLIN_WEB_APP_BASE_URL: ${{ secrets.NEXT_PUBLIC_ZEPLIN_WEB_APP_BASE_URL_DEV }}
NEXT_PUBLIC_ZEPLIN_APP_URI_SCHEME: ${{ secrets.NEXT_PUBLIC_ZEPLIN_APP_URI_SCHEME_DEV }}
NEXT_PRIVATE_LOG_DNA_KEY: ${{ secrets.NEXT_PRIVATE_LOG_DNA_KEY_DEV }}
NEXT_PRIVATE_NEW_RELIC_LOG_LEVEL: ${{ secrets.NEXT_PRIVATE_NEW_RELIC_LOG_LEVEL_DEV }}
NEXT_PRIVATE_NEW_RELIC_LICENSE_KEY: ${{ secrets.NEXT_PRIVATE_NEW_RELIC_LICENSE_KEY_DEV }}
NEXT_PUBLIC_ENVIRONMENT: dev
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Set `NEXT_PUBLIC_VERSION` variable
run: echo "NEXT_PUBLIC_VERSION=0.0.0-${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set `TARBALL` variable
run: echo "TARBALL=microsoft-teams-app-dev-latest.tar.gz" >> $GITHUB_ENV
- name: Use Node.js 16.13
uses: actions/setup-node@v2
with:
node-version: 16.13
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Install production dependencies
run: npm ci --production
- name: Create release
run: tar -czf $TARBALL ./node_modules ./package.json ./pm2.json dist
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload release
run: aws s3 cp $TARBALL $S3_PATH/
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Set `NEXT_PUBLIC_VERSION` variable
run: echo "NEXT_PUBLIC_VERSION=0.0.0-${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set environments
run: aws opsworks --region $AWS_REGION update-app --app-id $AWS_APP_ID --environment "$(scripts/get_environment.js)"
- name: Deploy
run: >
aws opsworks --region $AWS_REGION create-deployment --stack-id $AWS_STACK_ID --layer-ids $AWS_LAYER_ID --app-id $AWS_APP_ID --command "{\"Name\":\"deploy\"}" --custom-json "{\"zeplin\": {\"app_shortname\":\"zeplin_microsoft_teams_app\"}}"