-
Notifications
You must be signed in to change notification settings - Fork 212
119 lines (115 loc) · 4.86 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
118
119
name: Deploy
on:
push:
tags:
- '*'
jobs:
checkTag:
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.check.outputs.valid }}
app: ${{ steps.check.outputs.app }}
network: ${{ steps.check.outputs.network }}
version: ${{ steps.check.outputs.version }}
tag: ${{ steps.check.outputs.tag }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: check tag name
id: check
run: |
VERSION=$(python ./.github/scripts/tag_helper.py ${GITHUB_REF##*/} "version")
APP=$(python ./.github/scripts/tag_helper.py ${GITHUB_REF##*/} "app")
NETWORK=$(python ./.github/scripts/tag_helper.py ${GITHUB_REF##*/} "network")
TAG=${GITHUB_REF##*/}
if [ "$APP" != "" ] && [ "$NETWORK" != "" ] && [ "$VERSION" != "" ]; then
echo "::set-output name=valid::true"
echo "::set-output name=app::$APP"
echo "::set-output name=network::$NETWORK"
echo "::set-output name=version::$VERSION"
echo "::set-output name=tag::$TAG"
else
echo "::set-output name=valid::false"
fi
deploy:
runs-on: ubuntu-latest
needs: [checkTag]
if: needs.checkTag.outputs.valid == 'true'
environment: ${{ needs.checkTag.outputs.network }}
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 14
- name: setup ipfs
uses: ibnesayeed/setup-ipfs@master
with:
run_daemon: true
- name: Configure aragon cli
run: |
mkdir -p ~/.aragon
echo ${{ secrets.ARAGON_CLI_JSON }} >> ~/.aragon/${{ needs.checkTag.outputs.network }}_key.json
- name: Install npm packages
run: yarn
- name: build, publish and package
id: build
run: |
cd apps/${{ needs.checkTag.outputs.app }}
yarn --ignore-engines --dev
if [[ -d app ]]; then
yarn build
fi
- name: publish
id: publish
run: |
cd apps/${{ needs.checkTag.outputs.app }}
PUBLISH_MESSAGE=$(npx hardhat publish ${{ needs.checkTag.outputs.version }} --skip-validation --skip-app-build --network ${{ needs.checkTag.outputs.network }})
echo "::set-output name=cid::$(echo $PUBLISH_MESSAGE | sed -nE 's/^.*ContentURI: *([^ ]*) *.*$/\1/p')"
echo "::set-output name=contract::$(echo $PUBLISH_MESSAGE | sed -nE 's/^.*Contract address: *([^ ]*) *.*$/\1/p')"
echo "::set-output name=txhash::$(echo $PUBLISH_MESSAGE | sed -nE 's/^.*Tx hash: *([^ ]*) *.*$/\1/p')"
- name: package app
id: packaging
env:
CID: ${{ steps.publish.outputs.cid }}
PACKAGE_NAME: ${{ needs.checkTag.outputs.app }}.aragonpm.eth@${{ needs.checkTag.outputs.version }}
run: |
cd $(mktemp -d)
ipfs get $CID
tar -czvf $PACKAGE_NAME.tar.gz $CID/
echo "::set-output name=tar::$(echo $PWD/$PACKAGE_NAME.tar.gz)"
echo "::set-output name=tempdir::$(echo $PWD)"
- name: Install ipfs-cluster-ctl
run: |
wget https://dist.ipfs.io/ipfs-cluster-ctl/v1.0.0/ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz
tar xvfz ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz
- name: pin on cluster
working-directory: ${{ steps.packaging.outputs.tempdir }}
env:
CID: ${{ steps.publish.outputs.cid }}
IPFS_CLUSTER_BASIC_AUTH: ${{ secrets.IPFS_CLUSTER_BASIC_AUTH }}
IPFS_CLUSTER_HOST: ${{ secrets.IPFS_CLUSTER_HOST }}
run: $GITHUB_WORKSPACE/ipfs-cluster-ctl/ipfs-cluster-ctl --basic-auth $IPFS_CLUSTER_BASIC_AUTH --host "$IPFS_CLUSTER_HOST" add -r $CID
- name: create release notes
id: release
env:
APP: ${{ needs.checkTag.outputs.app }}
VERSION: ${{ needs.checkTag.outputs.version }}
NETWORK: ${{ needs.checkTag.outputs.network }}
CID: ${{ steps.publish.outputs.cid }}
CONTRACT: ${{ steps.publish.outputs.contract }}
TXHASH: ${{ steps.publish.outputs.txhash }}
OUTPUT_FILE: ${{ steps.packaging.outputs.tempdir }}/release.txt
run: |
.github/scripts/release-notes.sh $OUTPUT_FILE $APP $NETWORK $VERSION "$CID" "$CONTRACT" $GITHUB_SHA "$TXHASH"
echo "::set-output name=notes::$OUTPUT_FILE"
- uses: "softprops/action-gh-release@v1"
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: false
body_path: ${{ steps.release.outputs.notes }}
files: |
${{ steps.packaging.outputs.tar }}