Skip to content

825 automate preview deployment #9

825 automate preview deployment

825 automate preview deployment #9

name: Vercel preview apps on label
on:
pull_request:
types: [labeled]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Build
env:
NODE_OPTIONS: "--openssl-legacy-provider"
run: |
yarn --frozen-lockfile --prefer-offline
./node_modules/.bin/ember build --output-path="test_build" --environment=development
deploy:
if: ${{ github.event.label.name == 'create-preview-app' }}
needs: build
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract variables
shell: bash
run: |
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT
echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "GIT_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: extract_variables
- name: Vercel deploy
uses: amondnet/[email protected]
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID}}
vercel-args: ${{ vars.VERCEL_NOCACHE == 'true' && '--force' || '' }}
scope: ${{ secrets.TEAM_ID}}
vercel-project-name: 'bracco'
- name: Remove label
uses: fastruby/pr-unlabeler@v1
with:
label-to-remove: "create-preview-app"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}