Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/deploy-wagmi-to-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy Wagmi Integration to GitHub Pages

on:
workflow_call:
inputs:
destination_dir:
required: true
type: string
secrets:
PUBLISH_DOCS_TOKEN:
required: true
workflow_dispatch:
inputs:
destination_dir:
description: 'Destination directory on GitHub Pages (e.g., "latest", "5.0.0", "wagmi")'
required: true
type: string

jobs:
deploy-wagmi-to-gh-pages:
name: Deploy Wagmi Integration to GitHub Pages
runs-on: ubuntu-latest
environment: gh-pages
permissions:
contents: write

steps:
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1

- uses: actions/checkout@v4

- name: Install Corepack via Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Install Yarn
run: corepack enable

- name: Restore Yarn cache
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Install dependencies via Yarn
run: yarn --immutable

- name: Build workspace dependencies
run: |
# Build all packages (workspace dependencies) in topological order
# This ensures @metamask/connect-evm and other dependencies are built first
yarn workspaces foreach --all --topological-dev --verbose --no-private run build

- name: Build wagmi integration
working-directory: integrations/wagmi
env:
VITE_BASE_PATH: /${{ inputs.destination_dir }}/
run: yarn build

- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
with:
# This `PUBLISH_DOCS_TOKEN` needs to be manually set per-repository.
# Look in the repository settings under "Environments", and set this token in the `github-pages` environment.
personal_token: ${{ secrets.PUBLISH_DOCS_TOKEN }}
publish_dir: ./integrations/wagmi/dist
destination_dir: ${{ inputs.destination_dir }}

1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}

all-jobs-complete:
name: All jobs complete
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
required: true
SLACK_WEBHOOK_URL:
required: true
PUBLISH_DOCS_TOKEN:
required: true

jobs:
publish-release:
Expand Down Expand Up @@ -71,3 +73,48 @@ jobs:
uses: MetaMask/action-npm-publish@v5
with:
npm-token: ${{ secrets.NPM_TOKEN }}

get-release-version:
needs: publish-npm
runs-on: ubuntu-latest
outputs:
RELEASE_VERSION: ${{ steps.get-release-version.outputs.RELEASE_VERSION }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 0
- id: get-release-version
shell: bash
run: |
# Get version from the latest git tag created by the release action
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$VERSION" ]; then
# Fallback to package.json version if no tag found
VERSION=$(node -p "require('./package.json').version")
fi
# Remove 'v' prefix if present
VERSION=${VERSION#v}
echo "RELEASE_VERSION=$VERSION" >> "$GITHUB_OUTPUT"

publish-wagmi-to-gh-pages:
name: Publish Wagmi Integration to `${{ needs.get-release-version.outputs.RELEASE_VERSION }}` directory of `gh-pages` branch
needs: get-release-version
permissions:
contents: write
uses: ./.github/workflows/deploy-wagmi-to-gh-pages.yml
with:
destination_dir: ${{ needs.get-release-version.outputs.RELEASE_VERSION }}
secrets:
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}

publish-wagmi-to-latest-gh-pages:
name: Publish Wagmi Integration to `latest` directory of `gh-pages` branch
needs: publish-npm
permissions:
contents: write
uses: ./.github/workflows/deploy-wagmi-to-gh-pages.yml
with:
destination_dir: latest
secrets:
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}
1 change: 1 addition & 0 deletions integrations/wagmi/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: process.env.VITE_BASE_PATH || '/',
})
Loading