fix: upgrade wrangler #227
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: Website | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'packages/website/**' | |
- 'pnpm-lock.yaml' | |
- '.github/workflows/website.yml' | |
pull_request: | |
paths: | |
- 'packages/website/**' | |
- 'pnpm-lock.yaml' | |
- '.github/workflows/website.yml' | |
jobs: | |
check: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- run: pnpm install | |
- name: Run build | |
env: | |
# Fake environment vars required for build | |
NEXT_PUBLIC_ENV: dev | |
run: pnpm build:website | |
- name: Run test | |
run: pnpm test:website | |
test-e2e: | |
name: ${{ matrix.os }} (${{ matrix.browser }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: | |
- firefox | |
- chromium | |
os: | |
- ubuntu-18.04 | |
node-version: | |
- 16 | |
test_results_path: | |
# corresponds to playwright invocation/configuration | |
- packages/website/test-results | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'pnpm' | |
- run: pnpm install | |
env: | |
DEBUG: pw:install | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium | |
working-directory: packages/website | |
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm --filter website run test:e2e --project=${{ matrix.browser }} | |
- name: Check for website test results | |
id: check_website_test_results | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: ${{ matrix.test_results_path }} | |
- if: steps.check_website_test_results.outputs.files_exists == 'true' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.browser }}-${{ matrix.os }}-test-results | |
path: ${{ matrix.test_results_path }} | |
build: | |
name: Build & Add to IPFS | |
runs-on: ubuntu-latest | |
outputs: | |
cid: ${{ steps.ipfs.outputs.cid }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v2.0.1 | |
with: | |
version: 7.0.x | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- run: pnpm install | |
- name: Run build | |
env: | |
# Fake environment vars required for build | |
NEXT_PUBLIC_ENV: dev | |
run: pnpm build:website | |
# Add the site to web3.storage, output the cid as `steps.ipfs.outputs.cid` | |
- name: Add to web3.storage | |
uses: web3-storage/add-to-web3@v2 | |
id: ipfs | |
with: | |
path_to_add: packages/website/out | |
web3_token: ${{ secrets.WEB3_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo ${{ steps.ipfs.outputs.url }} | |
# Publish to the staging domain if it's a change on main 🚀 | |
deploy: | |
name: Deploy https://staging.nftstorage.link | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v2.0.1 | |
with: | |
version: 7.0.x | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- run: pnpm install | |
- run: npx dnslink-cloudflare --record staging --domain nftstorage.link --link /ipfs/${{ needs.build.outputs.cid }} | |
env: | |
CF_API_TOKEN: ${{ secrets.CF_GATEWAY_TOKEN }} | |
release: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
name: Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: GoogleCloudPlatform/release-please-action@v3 | |
id: tag-release | |
with: | |
path: packages/website | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
monorepo-tags: true | |
package-name: website | |
- uses: actions/checkout@v2 | |
if: ${{ steps.tag-release.outputs.releases_created }} | |
- uses: pnpm/action-setup@v2.0.1 | |
if: ${{ steps.tag-release.outputs.releases_created }} | |
with: | |
version: 7.0.x | |
- uses: actions/setup-node@v2 | |
if: ${{ steps.tag-release.outputs.releases_created }} | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- run: pnpm install | |
if: ${{ steps.tag-release.outputs.releases_created }} | |
- name: Run build | |
env: | |
# Fake environment vars required for build | |
NEXT_PUBLIC_ENV: production | |
run: pnpm build:website | |
if: ${{ steps.tag-release.outputs.releases_created }} | |
- run: pnpm exec wrangler pages publish --project-name nftstorage-link --branch main ./packages/website/out | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_GATEWAY_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT }} | |
if: ${{ steps.tag-release.outputs.releases_created }} | |
- run: npx dnslink-cloudflare --record _dnslink --domain nftstorage.link --link /ipfs/${{ needs.build.outputs.cid }} | |
env: | |
CF_API_TOKEN: ${{ secrets.CF_GATEWAY_TOKEN }} | |
if: ${{ steps.tag-release.outputs.releases_created }} |