Skip to content

Bump the npm_and_yarn group across 3 directories with 2 updates #296

Bump the npm_and_yarn group across 3 directories with 2 updates

Bump the npm_and_yarn group across 3 directories with 2 updates #296

Workflow file for this run

# Releases a new version on a push to main + redeploys on Vercel with that version
# On other branches, will dry-run the release version to see what we'll release when deployed
name: Release
on:
- push
env:
VERCEL_DEPLOY_TOKEN: ${{ secrets.VERCEL_DEPLOY_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get-version:
timeout-minutes: 5
name: 'Dry run of release version'
if: github.ref != 'refs/heads/main' # only on non-main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'pnpm'
- run: pnpm install
- name: Dry run release onto main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm turbo release -- --dry-run --branches="main, ${{ github.ref_name }}"
release:
timeout-minutes: 5
name: 'Release new version'
if: github.ref == 'refs/heads/main' # do not run elsewhere!
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'pnpm'
- run: pnpm install
- name: Release new repo version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm turbo release -- --branches="main"
redeploy:
timeout-minutes: 5
name: 'Redeploy with new version'
if: github.ref == 'refs/heads/main' # do not run elsewhere!
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'pnpm'
- run: pnpm install
- uses: actions-ecosystem/action-get-latest-tag@v1
name: Get latest version tag
with:
semver_only: true
id: latest-version-tag
- name: Pull Vercel Environment Information
if: ${{ steps.latest-version-tag.outputs.tag != '' }}
run: pnpm vercel pull --yes --environment=production --token=${{ env.VERCEL_DEPLOY_TOKEN }}
- name: Build Project Artifacts with latest version
if: ${{ steps.latest-version-tag.outputs.tag != '' }}
run: |
echo "Latest tag: ${LATEST_TAG}"
NEXT_PUBLIC_APP_VERSION="${LATEST_TAG}" pnpm vercel build --prod --token=${{ env.VERCEL_DEPLOY_TOKEN }}
env:
LATEST_TAG: ${{ steps.latest-version-tag.outputs.tag }}
- name: Deploy Project Artifacts to Vercel
if: ${{ steps.latest-version-tag.outputs.tag != '' }}
run: pnpm vercel deploy --prebuilt --prod --token=${{ env.VERCEL_DEPLOY_TOKEN }}