v0.9.9 #31
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
on: | |
release: | |
types: | |
- published | |
name: Release Production | |
env: | |
S3_PATH: ${{ secrets.S3_PATH_PROD }} | |
AWS_REGION: ${{ secrets.AWS_REGION_PROD }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} | |
AWS_STACK_ID: ${{ secrets.AWS_STACK_ID_PROD }} | |
AWS_LAYER_ID: ${{ secrets.AWS_LAYER_ID_PROD }} | |
AWS_APP_ID: ${{ secrets.AWS_APP_ID_PROD }} | |
NEXT_PRIVATE_BASE_URL: ${{ secrets.NEXT_PRIVATE_BASE_URL_PROD }} | |
NEXT_PRIVATE_DOMAIN: ${{ secrets.NEXT_PRIVATE_DOMAIN_PROD }} | |
NEXT_PRIVATE_PORT: ${{ secrets.NEXT_PRIVATE_PORT_PROD }} | |
NEXT_PRIVATE_REDIS_URL: ${{ secrets.NEXT_PRIVATE_REDIS_URL_PROD }} | |
NEXT_PRIVATE_MONGO_URL: ${{ secrets.NEXT_PRIVATE_MONGO_URL_PROD }} | |
NEXT_PRIVATE_IS_MONGO_DEBUG: ${{ secrets.NEXT_PRIVATE_IS_MONGO_DEBUG_PROD }} | |
NEXT_PRIVATE_ZEPLIN_URL: ${{ secrets.NEXT_PRIVATE_ZEPLIN_URL_PROD }} | |
NEXT_PRIVATE_ZEPLIN_CLIENT_ID: ${{ secrets.NEXT_PRIVATE_ZEPLIN_CLIENT_ID_PROD }} | |
NEXT_PRIVATE_ZEPLIN_CLIENT_SECRET: ${{ secrets.NEXT_PRIVATE_ZEPLIN_CLIENT_SECRET_PROD }} | |
NEXT_PRIVATE_WEBHOOK_SECRET: ${{ secrets.NEXT_PRIVATE_WEBHOOK_SECRET_PROD }} | |
NEXT_PRIVATE_MIXPANEL_TOKEN: ${{ secrets.NEXT_PRIVATE_MIXPANEL_TOKEN_PROD }} | |
NEXT_PRIVATE_IS_MIXPANEL_ENABLED: ${{ secrets.NEXT_PRIVATE_IS_MIXPANEL_ENABLED_PROD }} | |
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN_PROD }} | |
NEXT_PUBLIC_IS_SENTRY_ENABLED: ${{ secrets.NEXT_PUBLIC_IS_SENTRY_ENABLED_PROD }} | |
NEXT_PUBLIC_ZEPLIN_WEB_APP_BASE_URL: ${{ secrets.NEXT_PUBLIC_ZEPLIN_WEB_APP_BASE_URL_PROD }} | |
NEXT_PUBLIC_ZEPLIN_APP_URI_SCHEME: ${{ secrets.NEXT_PUBLIC_ZEPLIN_APP_URI_SCHEME_PROD }} | |
NEXT_PRIVATE_LOG_DNA_KEY: ${{ secrets.NEXT_PRIVATE_LOG_DNA_KEY_PROD }} | |
NEXT_PRIVATE_NEW_RELIC_LOG_LEVEL: ${{ secrets.NEXT_PRIVATE_NEW_RELIC_LOG_LEVEL_PROD }} | |
NEXT_PRIVATE_NEW_RELIC_LICENSE_KEY: ${{ secrets.NEXT_PRIVATE_NEW_RELIC_LICENSE_KEY_PROD }} | |
NEXT_PUBLIC_ENVIRONMENT: prod | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set `NEXT_PUBLIC_VERSION` variable | |
run: echo "NEXT_PUBLIC_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Set `TARBALL` variable | |
run: echo "TARBALL=microsoft-teams-app-prod-${NEXT_PUBLIC_VERSION}.tar.gz" >> $GITHUB_ENV | |
- name: Use Node.js 16.13 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.13 | |
cache: 'npm' | |
- name: Install npm cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- 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=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Set `TARBALL` variable | |
run: echo "TARBALL=microsoft-teams-app-prod-${NEXT_PUBLIC_VERSION}.tar.gz" >> $GITHUB_ENV | |
- name: Change latest release | |
run: aws s3 cp $S3_PATH/$TARBALL $S3_PATH/microsoft-teams-app-prod-latest.tar.gz | |
- 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\"}}" | |