Skip to content

Commit

Permalink
test deploy with different action
Browse files Browse the repository at this point in the history
  • Loading branch information
kaysiz committed Oct 16, 2023
1 parent 136d440 commit 124a0c0
Showing 1 changed file with 21 additions and 42 deletions.
63 changes: 21 additions & 42 deletions .github/workflows/preview-app-label.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,39 @@
name: Vercel preview apps on label

env:
VERCEL_ACCESS_TOKEN: ${{ secrets.VERCEL_ACCESS_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.PROJECT_ID }}

on:
pull_request:
types: [labeled]
jobs:
build:
name: Build
deploy:
if: ${{ github.event.label.name == 'create preview app' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: snaplet/vercel-action@v3
- name: Remove label
uses: fastruby/pr-unlabeler@v1
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
label-to-remove: "create-preview-app"
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
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

delete:
if: ${{ github.event.label.name == 'destroy preview app' }}
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]
- uses: actions/checkout@v3
- uses: snaplet/vercel-action@v3
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
delete: true
- uses: fastruby/pr-unlabeler@v1
with:
label-to-remove: "create preview app"
env:
Expand Down

0 comments on commit 124a0c0

Please sign in to comment.