-
Notifications
You must be signed in to change notification settings - Fork 8
66 lines (63 loc) · 2.12 KB
/
packages-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
name: Packages release
on:
pull_request:
types:
- closed
jobs:
prepare:
name: Prepare release generation
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/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: './${{ 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 }}-${{ matrix.package }}`,
sha: "${{ github.sha }}"
})