style: add house style (#22) #75
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: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yml | |
preview: | |
name: Preview | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ (github.ref_name == 'main') && 'staging' || format('preview-{0}', github.ref_name) }} | |
url: ${{ (github.ref_name == 'main') && 'https://staging.console.web3.storage/' || steps.cloudflare_url.outputs.stdout }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/pnpm | |
- name: create .env from .env.tpl setting env variables used by `pnpm run build` | |
run: | | |
# set env vars from template | |
# omit these because they are added manually in the next step | |
function excludeDefaultServiceVariables() { | |
cat - | grep -v NEXT_PUBLIC_SERVICE_ | grep -v NEXT_PUBLIC_W3UP_PROVIDER | |
} | |
# set .env from .env.tpl with exclusions | |
cat .env.tpl | excludeDefaultServiceVariables > .env | |
- run: pnpm pages:build | |
env: | |
NEXT_PUBLIC_SERVICE_DID: 'did:web:staging.web3.storage' | |
NEXT_PUBLIC_SERVICE_URL: 'https://staging.up.web3.storage' | |
NEXT_PUBLIC_W3UP_PROVIDER: 'did:web:staging.web3.storage' | |
- name: Deploy preview build to Cloudflare Pages | |
uses: mathiasvr/[email protected] | |
id: cloudflare | |
with: | |
run: npx wrangler pages deploy --project-name w3up-website-staging --branch "$GITHUB_REF_NAME" --commit-hash "$GITHUB_SHA" .vercel/output/static | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | |
- name: Find Cloudflare Pages preview URL | |
uses: mathiasvr/[email protected] | |
id: cloudflare_url | |
with: | |
run: egrep -o 'https?://[^ ]+' <(echo "${{ steps.cloudflare.outputs.stdout }}") | |
- name: Find Current Pull Request | |
uses: jwalton/[email protected] | |
id: finder | |
- name: Update Preview URLs PR Comment | |
uses: marocchino/[email protected] | |
with: | |
number: ${{ steps.finder.outputs.pr }} | |
message: | | |
### Website preview 🔗✨ | |
- ⛅️ ${{ 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 🔗✨ | |
- ⛅️ ${{ 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: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
monorepo-tags: true | |
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Other Changes","hidden":false}]' | |
release: | |
name: Release | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changelog.outputs.releases_created) || inputs.force_release | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://w3up.web3.storage | |
needs: | |
- test | |
- preview | |
- changelog | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/pnpm | |
- run: pnpm pages:build | |
env: | |
NEXT_PUBLIC_SERVICE_DID: 'did:web:web3.storage' | |
NEXT_PUBLIC_SERVICE_URL: 'https://up.web3.storage' | |
NEXT_PUBLIC_W3UP_PROVIDER: 'did:web:web3.storage' | |
- name: Deploy preview build to Cloudflare Pages | |
uses: mathiasvr/[email protected] | |
id: cloudflare | |
with: | |
run: npx wrangler pages deploy --project-name w3up-website --branch "main" --commit-hash "$GITHUB_SHA" .vercel/output/static | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} |