-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (78 loc) · 2.81 KB
/
python_publish_release_management.yaml
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
name: Merge with main branch
on:
pull_request:
types: [closed]
branches:
- main
jobs:
main-pr-merge:
if: github.event.pull_request.merged == true
permissions: write-all
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release_action_plan.outputs.releases_created }}
matrix: ${{ steps.create-matrix.outputs.matrix }}
steps:
- name: Checkout our repository
uses: actions/checkout@v2
with:
ref: main
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Release Please
id: release_action_plan
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: .github/configuration/release-please-config.json
manifest-file: .github/configuration/release-please-manifest.json
include-component-in-tag: true
target-branch: main
- name: Create matrix for release
id: create-matrix
uses: actions/github-script@v5
with:
script: |
const allOutputs = ${{toJson(steps.release_action_plan.outputs)}};
console.log("all outputs",allOutputs);
const pathsReleased = JSON.parse('${{ steps.release_action_plan.outputs.paths_released }}');
console.log("pathsReleased",pathsReleased);
let includeArray = pathsReleased.map(path => {
const tag_name = allOutputs[`${path}--tag_name`];
return { path, tag_name };
});
core.setOutput('matrix', JSON.stringify({ include: includeArray }));
#TODO: fix the path and add publish. The only release that needs to be skipped is website
release-matrix:
runs-on: ubuntu-latest
needs: main-pr-merge
permissions:
contents: read
packages: write
id-token: write
if: needs.main-pr-merge.outputs.release_created == 'true'
strategy:
matrix: ${{ fromJson(needs.main-pr-merge.outputs.matrix) }}
steps:
- name: Checkout our repository
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
# todo: the below three steps are not required use github artifact to transfer the build between workflows :) but doing it as of now for alpha releases
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.8.3"
# - name: Build poetry
# working-directory: ${{ matrix.path }}
# run: poetry build -f wheel
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# packages-dir: ${{ matrix.path }}/dist