Repository navigation
87 lines (75 loc) · 3.28 KB
/
Copy pathpreview-deploy.yml
File metadata and controls
87 lines (75 loc) · 3.28 KB
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
name: IPFS Deploy
on:
workflow_run:
workflows: ["Code Build"]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.13.0]
steps:
- name: Get build workflow details
uses: potiuk/get-workflow-origin@v1_3
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
- name: Start Deployment
uses: bobheadxi/deployments@v0.6.0
id: deployment
if: steps.source-run-info.outputs.sourceHeadRepo == 'DXgovernance/DAVI'
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ steps.source-run-info.outputs.sourceHeadBranch }}
no_override: false
ref: ${{ steps.source-run-info.outputs.sourceHeadBranch }}
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: preview-build.yml
workflow_conclusion: success
name: ${{ steps.source-run-info.outputs.targetCommitSha }}
path: 'build'
- name: Deploy to IPFS
uses: web3-storage/add-to-web3@v1
id: web3
with:
web3_token: ${{ secrets.WEB3_STORAGE_TOKEN }}
path_to_add: 'build'
- name: Update DNS record for Develop branch
run: npx dnslink-cloudflare --domain project-davi.dev --record _dnslink --link /ipfs/${{ steps.web3.outputs.cid }}
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
if: steps.source-run-info.outputs.sourceHeadRepo == 'DXgovernance/DAVI' && steps.source-run-info.outputs.sourceHeadBranch == 'develop'
- name: Update DNS record for Master branch
run: npx dnslink-cloudflare --domain project-davi.dev --record _dnslink.prod --link /ipfs/${{ steps.web3.outputs.cid }}
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
if: steps.source-run-info.outputs.sourceHeadRepo == 'DXgovernance/DAVI' && steps.source-run-info.outputs.sourceHeadBranch == 'master'
- name: Update Deployment Status
uses: bobheadxi/deployments@v0.6.0
if: steps.source-run-info.outputs.sourceHeadRepo == 'DXgovernance/DAVI'
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: 'https://${{ steps.web3.outputs.cid }}.ipfs.cf-ipfs.com'
- name: Create comment with status
uses: peter-evans/create-or-update-comment@v1
if: ${{ steps.source-run-info.outputs.pullRequestNumber }}
with:
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
body: |
✔️ Preview deployment is ready!
🔨 Explore the source changes: ${{ steps.source-run-info.outputs.mergeCommitSha }}
😎 Browse the preview at one of these gateways:
- https://${{ steps.web3.outputs.cid }}.ipfs.w3s.link
- https://${{ steps.web3.outputs.cid }}.ipfs.cf-ipfs.com
- https://${{ steps.web3.outputs.cid }}.ipfs.dweb.link
- https://${{ steps.web3.outputs.cid }}.ipfs.ipfs-gateway.cloud