Skip to content

Add announcement slot for Identity 0.5 #584

Add announcement slot for Identity 0.5

Add announcement slot for Identity 0.5 #584

Workflow file for this run

name: preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
workflow_dispatch:
pull_request:
branches:
- main
jobs:
build:
strategy:
matrix:
environment: [iota, shimmer, next]
uses: ./.github/workflows/build.reusable.yaml
with:
environment: ${{ matrix.environment }}
config:
uses: ./.github/workflows/config.reusable.yaml
deploy:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
needs:
- build
- config
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
# All previous jobs upload to same artifact so only a single download required
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
# Paths of the build artifacts are preserved (`build`, `build/shimmer`, and `build/next`)
- name: Extract build
run: |
tar -xf iota.tar
tar -xf shimmer.tar
tar -xf next.tar
# Convert to Vercel project and upload
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt
# Set the deploy URL as an output
- name: Set deploy url
id: deploy_url
run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT
# Create a comment on the pull request with the deployed URL
- name: Comment on pull request
uses: actions/github-script@v6.4.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const DEPLOY_URL = '${{ steps.deploy_url.outputs.DEPLOY_URL }}'
const COMMIT_SHA = '${{ github.event.pull_request.head.sha }}'
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This pull request has been deployed to Vercel.\n\n\nLatest commit: ${COMMIT_SHA}\n\n:white_check_mark: Preview: ${DEPLOY_URL}`
})