Skip to content

Commit bc8791a

Browse files
committed
ci: split build and deploy workflow
1 parent ab40364 commit bc8791a

File tree

2 files changed

+61
-47
lines changed

2 files changed

+61
-47
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Deploy
1+
name: Build
22

33
# Explicitly declare permissions
44
permissions:
@@ -13,11 +13,6 @@ on:
1313
pull_request:
1414
branches:
1515
- main
16-
workflow_run:
17-
workflows:
18-
- Build and Deploy
19-
types:
20-
- completed
2116

2217
env:
2318
BUILD_PATH: 'out'
@@ -28,7 +23,6 @@ concurrency:
2823

2924
jobs:
3025
build:
31-
if: github.event_name == 'push' || github.event_name == 'pull_request'
3226
runs-on: ubuntu-latest
3327
steps:
3428
- name: Checkout code
@@ -53,46 +47,6 @@ jobs:
5347
name: github-pages
5448
path: ${{ env.BUILD_PATH }}
5549

56-
deploy:
57-
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
58-
runs-on: ubuntu-latest
59-
needs: build
60-
outputs:
61-
cid: ${{ steps.deploy.outputs.cid }}
62-
steps:
63-
- uses: actions/download-artifact@v4
64-
with:
65-
name: github-pages
66-
path: ${{ env.BUILD_PATH }}
67-
run-id: ${{ github.event.workflow_run.id }}
68-
69-
- uses: ipfs/ipfs-deploy-action@v1
70-
name: Deploy to IPFS Mirror Providers
71-
id: deploy
72-
with:
73-
path-to-deploy: ${{ env.BUILD_PATH }}
74-
cluster-url: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
75-
cluster-user: ${{ secrets.CLUSTER_USER }}
76-
cluster-password: ${{ secrets.CLUSTER_PASSWORD }}
77-
storacha-key: ${{ secrets.STORACHA_KEY }}
78-
storacha-proof: ${{ secrets.STORACHA_PROOF }}
79-
#TODO pinata-jwt-token: ${{ secrets.PINATA_JWT_TOKEN }}
80-
github-token: ${{ github.token }}
81-
82-
# TODO: right now, DNSLink is controlled by Fleek, and we use ipfs/ipfs-deploy-action for PR previews
83-
#- name: Update DNSLink
84-
# if: false # TODO github.ref == 'refs/heads/main' # only update DNSLink for main branch
85-
# uses: ipfs/dnslink-action@v0.1
86-
# with:
87-
# cid: ${{ steps.deploy.outputs.cid }}
88-
# dnslink_domain: 'specs.ipfs.tech'
89-
# cf_record_id: ${{ secrets.CF_RECORD_ID }}
90-
# cf_zone_id: ${{ secrets.CF_ZONE_ID }}
91-
# cf_auth_token: ${{ secrets.CF_AUTH_TOKEN }}
92-
# github_token: ${{ github.token }}
93-
# set_github_status: true
94-
95-
9650
gh-pages:
9751
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # only deploy to gh-pages on push to the main branch
9852
runs-on: 'ubuntu-latest'

.github/workflows/deploy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy
2+
3+
# Explicitly declare permissions
4+
permissions:
5+
contents: read
6+
pull-requests: write
7+
statuses: write
8+
9+
on:
10+
workflow_run:
11+
workflows:
12+
- Build
13+
types:
14+
- completed
15+
16+
env:
17+
BUILD_PATH: 'out'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true # Cancel in progress runs if a new run is started
22+
23+
jobs:
24+
deploy:
25+
if: github.event.workflow_run.conclusion == 'success'
26+
runs-on: ubuntu-latest
27+
outputs:
28+
cid: ${{ steps.deploy.outputs.cid }}
29+
steps:
30+
- uses: actions/download-artifact@v4
31+
with:
32+
name: github-pages
33+
path: ${{ env.BUILD_PATH }}
34+
run-id: ${{ github.event.workflow_run.id }}
35+
36+
- uses: ipfs/ipfs-deploy-action@v1
37+
name: Deploy to IPFS Mirror Providers
38+
id: deploy
39+
with:
40+
path-to-deploy: ${{ env.BUILD_PATH }}
41+
cluster-url: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
42+
cluster-user: ${{ secrets.CLUSTER_USER }}
43+
cluster-password: ${{ secrets.CLUSTER_PASSWORD }}
44+
storacha-key: ${{ secrets.STORACHA_KEY }}
45+
storacha-proof: ${{ secrets.STORACHA_PROOF }}
46+
#TODO pinata-jwt-token: ${{ secrets.PINATA_JWT_TOKEN }}
47+
github-token: ${{ github.token }}
48+
49+
# TODO: right now, DNSLink is controlled by Fleek, and we use ipfs/ipfs-deploy-action for PR previews
50+
#- name: Update DNSLink
51+
# if: false # TODO github.ref == 'refs/heads/main' # only update DNSLink for main branch
52+
# uses: ipfs/dnslink-action@v0.1
53+
# with:
54+
# cid: ${{ steps.deploy.outputs.cid }}
55+
# dnslink_domain: 'specs.ipfs.tech'
56+
# cf_record_id: ${{ secrets.CF_RECORD_ID }}
57+
# cf_zone_id: ${{ secrets.CF_ZONE_ID }}
58+
# cf_auth_token: ${{ secrets.CF_AUTH_TOKEN }}
59+
# github_token: ${{ github.token }}
60+
# set_github_status: true

0 commit comments

Comments
 (0)