-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (77 loc) · 2.79 KB
/
create-pr-artifact.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
name: Create PR Artifact
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
jobs:
create_pr_artifact:
name: Create PR Artifact
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Cache "node_modules"
uses: actions/cache@v2
with:
path: '**/node_modules'
key: node_modules_${{ hashFiles('**/yarn.lock') }}
- name: Show context
run: |
echo github.event_name: ${{ github.event_name }}
echo github.event.number: ${{ github.event.number }}
echo github.sha: ${{ github.sha }}
echo github.repository: ${{ github.repository }}
echo github.ref: ${{ github.ref }}
echo github.head_ref: ${{ github.head_ref }}
echo github.base_ref: ${{ github.base_ref }}
echo "github.event.pull_request"
echo " .number" ${{ github.event.pull_request.number }}
echo " .state" ${{ github.event.pull_request.state }}
echo " .locked" ${{ github.event.pull_request.locked }}
echo " .draft" ${{ github.event.pull_request.draft }}
- name: Check changeset
run: tasks/check-changeset.sh ${{ github.sha }} dev
- name: Install dependencies
if: env.PUBLISH_PR_ARTIFACT == 1
run: yarn install --frozen-lockfile
- name: Compile contracts
run: yarn compile
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
- name: Setup PR package versions locally
if: env.PUBLISH_PR_ARTIFACT == 1
run: |
prNumber=${{ github.event.number }}
shortRev=$(git rev-parse --short ${{ github.sha }})
preId=PR${prNumber}.${shortRev}
yarn lerna version prerelease --yes --no-git-tag-version --preid ${preId}
- name: Create packages
if: env.PUBLISH_PR_ARTIFACT == 1
run: |
prNumber=${{ github.event.number }}
dirName="bin/${prNumber}"
mkdir -p $dirName
tgz=$(npm pack)
cp $tgz "$dirName/"
cd $dirName
sha="${{ github.event.pull_request.head.sha }}"
for f in * ; do
mv -- "$f" "${f%.tgz}-${sha:0:7}.tgz"
done
- name: Create empty artifact
if: env.PUBLISH_PR_ARTIFACT != 1
run: |
prNumber=${{ github.event.number }}
dirName="bin/${prNumber}"
mkdir -p $dirName
touch $dirName/.empty
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pr-packages
path: bin
retention-days: 1