forked from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (71 loc) · 2.36 KB
/
js-client-release.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
name: 01-JS-Release
on:
pull_request:
types:
- closed
paths:
- 'packages/js-client/**'
- '.github/workflows/js-client-*.yml'
jobs:
test:
uses: ./.github/workflows/javascript_test.yml
secrets:
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }}
prepare:
name: Prepare release generation
needs: ['test']
runs-on: ubuntu-latest
if: github.event.pull_request.merged
outputs:
PACKAGE_LIST: ${{ steps.matrix.outputs.pkg_list }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: 'develop'
- name: Setup Python environment
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Get package-list from label-list
id: matrix
run: |
PKG_LIST=$(python ./.github/scripts/js-client-generate-release-matrix.py)
PR_LABEL_LIST="${{ toJson(github.event.pull_request.labels.*.name) }}"
echo "Pkg list: $PKG_LIST"
echo "Label list: $PR_LABEL_LIST"
echo "pkg_list=$PKG_LIST" >> $GITHUB_OUTPUT
env:
PULL_LABELS: ${{ toJson(github.event.pull_request.labels) }}
release:
name: Set Github Tag
runs-on: ubuntu-latest
needs: [prepare]
## This condition gets TRUE if used in this way: ${{ contains(toJson(xyz), 'substr') }}
if: ${{ contains( toJson(github.event.pull_request.labels.*.name), '-release' ) }}
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.prepare.outputs.PACKAGE_LIST) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: 'develop'
- name: Get version from '${{ matrix.package }}' package.json
id: getver
working-directory: './packages/${{ matrix.package }}'
run: |
VERSION=$(cat package.json | jq -r .version)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Set Github Tag via API
uses: actions/github-script@v6
with:
github-token: ${{ secrets.ARABOT_PAT_TRIGGER_WORKFLOW }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${{ steps.getver.outputs.version }}-javascript-${{ matrix.package }}`,
sha: "${{ github.sha }}"
})