-
Notifications
You must be signed in to change notification settings - Fork 6
117 lines (111 loc) Β· 3.94 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
# path to built static site directory
outputDir: out
jobs:
preview:
name: Preview
if: (github.ref != 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- run: pnpm lint
- run: pnpm test
- run: pnpm build
- name: Add to web3.storage
uses: web3-storage/add-to-web3@v2
id: ipfs
with:
path_to_add: ${{ env.outputDir }}
web3_token: ${{ secrets.WEB3_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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" ${{ env.outputDir }}
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 πβ¨
- π https://${{ steps.ipfs.outputs.cid }}.ipfs.w3s.link
- β
οΈ ${{ 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://${{ steps.ipfs.outputs.cid }}.ipfs.w3s.link
- β
οΈ ${{ steps.cloudflare_url.outputs.stdout }}
" >> $GITHUB_STEP_SUMMARY
release:
name: Release
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
environment:
name: production
url: https://web3.storage
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pnpm
- run: pnpm lint
- run: pnpm test
- run: pnpm build
# - name: Add to web3.storage
# uses: web3-storage/add-to-web3@v2
# id: ipfs
# with:
# path_to_add: ${{ env.outputDir }}
# 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 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" ${{ env.outputDir }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
- name: Add Preview URLs as Job Summary
# run: |
# echo "
# ### Deployed
# β https://web3.storage
# ### Snapshot urls πβ¨
# - π https://${{ steps.ipfs.outputs.cid }}.ipfs.w3s.link
# - β
οΈ ${{ steps.cloudflare_url.outputs.stdout }}
# " >> $GITHUB_STEP_SUMMARY
run: |
echo "
### Deployed
β https://web3.storage
### Snapshot urls πβ¨
- β
οΈ ${{ steps.cloudflare_url.outputs.stdout }}
" >> $GITHUB_STEP_SUMMARY