feat: listUploads includes parts property with list of links to CARs that contain it #2316
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: Website | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
# test-e2e depends on api running too | |
- 'packages/api/**' | |
- 'packages/website/**' | |
- '.github/workflows/website.yml' | |
- 'package-lock.json' | |
pull_request: | |
paths: | |
- 'packages/website/**' | |
- '.github/workflows/website.yml' | |
- 'package-lock.json' | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
add_playwright_report_to_web3_storage: | |
description: Whether to add add_playwright_report_to_web3_storage to web3.storage (publicly) | |
required: true | |
type: boolean | |
default: true | |
force_release: | |
description: Whether to run the release job no matter what | |
required: true | |
type: boolean | |
default: false | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- uses: bahmutov/npm-install@v1 | |
- run: npm run lint -w packages/website | |
test-e2e: | |
if: false | |
name: "Test e2e - ${{ matrix.browser }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: | |
- firefox | |
- chromium | |
os: | |
- ubuntu-latest | |
node-version: | |
- 16 | |
test_results_path: | |
# corresponds to playwright invocation/configuration | |
- packages/website/test-results | |
runs-on: ${{ matrix.os }} | |
outputs: | |
playwright-report: ${{ steps.create_output_playwright_reporter.outputs.url }} | |
playwright-report-cid: ${{ steps.create_output_playwright_reporter_cid.outputs.cid }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: bahmutov/npm-install@v1 | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
# sed removes tempalted env vars that we want set from actual env and not env file | |
- name: write .env | |
run: npm -w '@web3-storage/website' run ci:envfile --silent > .env | |
env: | |
ENVFILE_WITHOUT: 'MAGIC_SECRET_KEY,NEXT_PUBLIC_MAGIC,NEXT_PUBLIC_MAGIC_TESTMODE_ENABLED' | |
- name: load db schema | |
run: | | |
npm run start -w packages/db | |
npm run load-schema -w packages/db | |
npm run stop -w packages/db | |
- run: npx playwright install --with-deps ${{ matrix.browser }} | |
working-directory: packages/website | |
# run e2e tests | |
- id: website_test_e2e | |
continue-on-error: true # when this fails, we still want to do some cleanup | |
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- node -r dotenv/config $(which npm) run -w @web3-storage/website test:e2e -- --project=${{ matrix.browser }} --reporter=html | |
env: | |
# Timeout is in milliseconds | |
PLAYWRIGHT_TIMEOUT: 120000 | |
NEXT_PUBLIC_MAGIC: ${{ secrets.STAGING_MAGIC_PUBLIC_KEY }} | |
MAGIC_SECRET_KEY: ${{ secrets.STAGING_MAGIC_SECRET_KEY }} | |
NEXT_PUBLIC_MAGIC_TESTMODE_ENABLED: "true" | |
API_MINIFLARE_FLAGS: '--binding NEXT_PUBLIC_MAGIC_TESTMODE_ENABLED=$NEXT_PUBLIC_MAGIC_TESTMODE_ENABLED --binding MAGIC_SECRET_KEY=$MAGIC_SECRET_KEY --binding NEXT_PUBLIC_MAGIC=$NEXT_PUBLIC_MAGIC' | |
- name: Check for website playwright-report | |
id: check_website_playwright_report | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: packages/website/playwright-report | |
# if playwright-report exists, upload it as artifact | |
- name: upload playwright-report artifact | |
if: steps.check_website_playwright_report.outputs.files_exists == 'true' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.browser }}-${{ matrix.os }}-playwright-report | |
path: packages/website/playwright-report | |
# add playwright-report to web3.storage | |
- name: add playwright-report to web3.storage | |
if: github.event.inputs.add_playwright_report_to_web3_storage && steps.check_website_playwright_report.outputs.files_exists == 'true' | |
uses: web3-storage/add-to-web3@v2 | |
id: add_playwright_report_to_web3_storage | |
with: | |
path_to_add: packages/website/playwright-report | |
web3_token: ${{ secrets.WEB3_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# output playwright-report on web3.storage cid | |
- id: create_output_playwright_reporter_cid | |
if: steps.add_playwright_report_to_web3_storage.outputs.cid | |
run: echo "::set-output name=cid::${{ steps.add_playwright_report_to_web3_storage.outputs.cid }}" | |
# log playwright-report on web3.storage cid | |
- name: log playwright-report on web3.storage cid | |
if: steps.add_playwright_report_to_web3_storage.outputs.cid | |
run: | | |
echo cid: ${{ steps.create_output_playwright_reporter_cid.outputs.cid }} | |
# output playwright-report on web3.storage url | |
- id: create_output_playwright_reporter_url | |
if: steps.add_playwright_report_to_web3_storage.outputs.cid | |
run: echo "::set-output name=url::https://w3s.link/ipfs/${{ steps.add_playwright_report_to_web3_storage.outputs.cid }}" | |
# log playwright-report on web3.storage url | |
- name: log playwright-report on web3.storage url | |
if: steps.create_output_playwright_reporter_url.outputs.url | |
run: | | |
echo url: ${{ steps.create_output_playwright_reporter_url.outputs.url }} | |
- name: add url to GITHUB_STEP_SUMMARY | |
if: steps.create_output_playwright_reporter_url.outputs.url | |
run: | | |
echo " | |
### playwright-report-${{ matrix.browser }}-${{ matrix.os }} | |
* url: ${{ steps.create_output_playwright_reporter_url.outputs.url }} | |
* cid: ${{ steps.create_output_playwright_reporter_cid.outputs.cid }} | |
" >> $GITHUB_STEP_SUMMARY | |
# if test-results, upload as artifact | |
- name: Check for website test results | |
id: check_website_test_results | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: ${{ matrix.test_results_path }} | |
- name: upload test-results artifact | |
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 }} | |
- name: fail if test:e2e didn't succeed | |
if: steps.website_test_e2e.outcome != 'success' | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('e2e tests did not succeed') | |
preview: | |
name: Preview | |
environment: | |
name: ${{ (github.ref_name == 'main') && 'staging' || format('preview-{0}', github.ref_name) }} | |
url: ${{ (github.ref_name == 'main') && 'https://staging.web3.storage/' || steps.cloudflare_url.outputs.stdout }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- uses: bahmutov/npm-install@v1 | |
- run: npm run build -w packages/client | |
- name: build website | |
run: | | |
echo NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START="$NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START" | |
npm run build -w packages/website | |
env: | |
NEXT_PUBLIC_ENV: staging | |
NEXT_PUBLIC_API: https://api-staging.web3.storage | |
NEXT_PUBLIC_MAGIC: ${{ secrets.STAGING_MAGIC_PUBLIC_KEY }} | |
NEXT_PUBLIC_COUNTLY_URL: ${{ secrets.COUNTLY_URL }} | |
NEXT_PUBLIC_COUNTLY_KEY: ${{ secrets.COUNTLY_KEY }} | |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.TESTING_STRIPE_PUBLISHABLE_KEY }} | |
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }} | |
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }} | |
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }} | |
DID_DOCUMENT_ID: ${{ secrets.STAGING_DID_DOCUMENT_ID }} | |
DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.STAGING_DID_DOCUMENT_PRIMARY_DID_KEY }} | |
- 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 }} | |
- name: Update IPFS DNSLink https://staging.web3.storage | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: npx dnslink-cloudflare --record staging --domain web3.storage --link /ipfs/${{ steps.ipfs.outputs.cid }} | |
env: | |
CF_API_TOKEN: ${{ secrets.CF_TOKEN }} | |
- name: Deploy preview build to Cloudflare Pages | |
uses: mathiasvr/command-output@v1.1.0 | |
id: cloudflare | |
with: | |
run: npx wrangler pages publish --project-name web3-storage-staging --branch "$GITHUB_REF_NAME" --commit-hash "$GITHUB_SHA" ./packages/website/out | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | |
- name: Find Cloudflare Pages preview URL | |
uses: mathiasvr/command-output@v1.1.0 | |
id: cloudflare_url | |
with: | |
run: egrep -o 'https?://[^ ]+' <(echo "${{ steps.cloudflare.outputs.stdout }}") | |
- name: Find Current Pull Request | |
uses: jwalton/gh-find-current-pr@v1.3.0 | |
id: finder | |
- name: Update Preview URLs PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2.2.0 | |
with: | |
number: ${{ steps.finder.outputs.pr }} | |
message: | | |
### Website preview 🔗✨ | |
- 🙂 https://w3s.link/ipfs/${{ steps.ipfs.outputs.cid }} | |
- ⛅️ ${{ steps.cloudflare_url.outputs.stdout }} | |
[build log](/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
- name: Add Preview URLs as Job Summary | |
run: | | |
echo " | |
### Website preview 🔗✨ | |
- 🙂 https://w3s.link/ipfs/${{ steps.ipfs.outputs.cid }} | |
- ⛅️ ${{ steps.cloudflare_url.outputs.stdout }} | |
[build log](/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY | |
changelog: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
name: Changelog | |
runs-on: ubuntu-latest | |
outputs: | |
releases_created: ${{ steps.tag-release.outputs.releases_created }} | |
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 | |
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Other Changes","hidden":false}]' | |
release: | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changelog.outputs.releases_created) || github.event.inputs.force_release | |
name: Release | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://web3.storage | |
needs: | |
- test | |
# - test-e2e | |
- preview | |
- changelog | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
registry-url: https://registry.npmjs.org/ | |
- uses: bahmutov/npm-install@v1 | |
- run: npm run build -w packages/client | |
- run: npm run build -w packages/website | |
env: | |
NEXT_PUBLIC_ENV: production | |
NEXT_PUBLIC_API: https://api.web3.storage | |
NEXT_PUBLIC_MAGIC: ${{ secrets.PROD_MAGIC_PUBLIC_KEY }} | |
NEXT_PUBLIC_COUNTLY_URL: ${{ secrets.COUNTLY_URL }} | |
NEXT_PUBLIC_COUNTLY_KEY: ${{ secrets.COUNTLY_KEY }} | |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | |
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }} | |
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }} | |
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }} | |
DID_DOCUMENT_ID: ${{ secrets.PRODUCTION_DID_DOCUMENT_ID }} | |
DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.PRODUCTION_DID_DOCUMENT_PRIMARY_DID_KEY }} | |
- 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 }} | |
- name: Update IPFS DNSLink https://web3.storage | |
run: npx dnslink-cloudflare --record _dnslink --domain web3.storage --link /ipfs/${{ steps.ipfs.outputs.cid }} | |
env: | |
CF_API_TOKEN: ${{ secrets.CF_TOKEN }} | |
- name: Deploy https://web3.storage to Cloudflare Pages | |
run: npx wrangler pages publish --project-name web3-storage --branch "main" --commit-hash "$GITHUB_SHA" ./packages/website/out | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_TOKEN}} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} |