Fix keychain production build #1399
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
name: deploy | |
on: push | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
CARGO_TERM_COLOR: always | |
RUST_VERSION: 1.80.1 | |
jobs: | |
keychain: | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_PROJECT_ID: "keychain" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Cache turbo build setup | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.turbo | |
packages/account-wasm/pkg-controller | |
packages/account-wasm/pkg-session | |
key: | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}-${{ github.sha | |
}} | |
restore-keys: | | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}- | |
${{ runner.os }}-turbo-cache- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build:deps | |
- name: Pull Vercel Environment Information (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=preview --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Pull Vercel Environment Information (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=production --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Production) | |
if: github.ref == 'refs/heads/main' | |
run: pnpm vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy to Vercel (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
echo "url=$(pnpm vercel deploy --prebuilt --token=${{ | |
secrets.VERCEL_TOKEN }})" > "$GITHUB_OUTPUT" | |
id: deploy | |
- name: Deploy to Vercel (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN | |
}} | |
- name: Set outputs | |
id: vars | |
run: | | |
git config --global --add safe.directory '*' | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Assign Alias | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel alias set ${{ steps.deploy.outputs.url }} keychain-${{ | |
steps.vars.outputs.sha_short }}.preview.cartridge.gg --scope=cartridge | |
--token=${{ secrets.VERCEL_TOKEN }} | |
keychain-storybook: | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_PROJECT_ID: "keychain-storybook" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Cache turbo build setup | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.turbo | |
packages/account-wasm/pkg-controller | |
packages/account-wasm/pkg-session | |
key: | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}-${{ github.sha | |
}} | |
restore-keys: | | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}- | |
${{ runner.os }}-turbo-cache- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build:deps | |
- name: Pull Vercel Environment Information (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=preview --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Pull Vercel Environment Information (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=production --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Production) | |
if: github.ref == 'refs/heads/main' | |
run: pnpm vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy to Vercel (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
echo "url=$(pnpm vercel deploy --prebuilt --token=${{ | |
secrets.VERCEL_TOKEN }})" > "$GITHUB_OUTPUT" | |
id: deploy | |
- name: Deploy to Vercel (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN | |
}} | |
- name: Set outputs | |
id: vars | |
run: | | |
git config --global --add safe.directory '*' | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Assign Alias | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel alias set ${{ steps.deploy.outputs.url }} | |
keychain-storybook-${{ steps.vars.outputs.sha_short | |
}}.preview.cartridge.gg --scope=cartridge --token=${{ | |
secrets.VERCEL_TOKEN }} | |
profile: | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_PROJECT_ID: "profile" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Cache turbo build setup | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.turbo | |
packages/account-wasm/pkg-controller | |
packages/account-wasm/pkg-session | |
key: | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}-${{ github.sha | |
}} | |
restore-keys: | | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}- | |
${{ runner.os }}-turbo-cache- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build:deps | |
- name: Pull Vercel Environment Information (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=preview --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Pull Vercel Environment Information (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=production --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Production) | |
if: github.ref == 'refs/heads/main' | |
run: pnpm vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy to Vercel (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
echo "url=$(pnpm vercel deploy --prebuilt --token=${{ | |
secrets.VERCEL_TOKEN }})" > "$GITHUB_OUTPUT" | |
id: deploy | |
- name: Deploy to Vercel (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN | |
}} | |
- name: Set outputs | |
id: vars | |
run: | | |
git config --global --add safe.directory '*' | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Assign Alias | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel alias set ${{ steps.deploy.outputs.url }} profile-${{ | |
steps.vars.outputs.sha_short }}.preview.cartridge.gg --scope=cartridge | |
--token=${{ secrets.VERCEL_TOKEN }} | |
controller-example-next: | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_PROJECT_ID: "controller-example-next" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Cache turbo build setup | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.turbo | |
packages/account-wasm/pkg-controller | |
packages/account-wasm/pkg-session | |
key: | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}-${{ github.sha | |
}} | |
restore-keys: | | |
${{ runner.os }}-turbo-cache-${{ github.ref_name }}- | |
${{ runner.os }}-turbo-cache- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm build:deps | |
- name: Pull Vercel Environment Information (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=preview --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Pull Vercel Environment Information (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel pull --yes --environment=production --token=${{ | |
secrets.VERCEL_TOKEN }} | |
- name: Set outputs | |
id: vars | |
run: | | |
git config --global --add safe.directory '*' | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build Project Artifacts (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: | | |
echo "NEXT_PUBLIC_KEYCHAIN_DEPLOYMENT_URL=https://keychain-${{ steps.vars.outputs.sha_short }}.preview.cartridge.gg" >> ./examples/next/.env.local | |
echo "NEXT_PUBLIC_PROFILE_DEPLOYMENT_URL=https://profile-${{ steps.vars.outputs.sha_short }}.preview.cartridge.gg" >> ./examples/next/.env.local | |
pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts (Production) | |
if: github.ref == 'refs/heads/main' | |
run: pnpm vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy to Vercel (Preview) | |
if: github.ref != 'refs/heads/main' | |
run: pnpm vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy to Vercel (Production) | |
if: github.ref == 'refs/heads/main' | |
run: | |
pnpm vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN | |
}} |