Skip to content

Commit c5ab0bb

Browse files
authored
Merge pull request #1310 from hkad98/jkd/release
chore: utilize trusted publisher in prod release
2 parents ec17904 + 69d3f4d commit c5ab0bb

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

.github/workflows/build-release.yaml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,28 @@ on:
1414
tags:
1515
- v*.*.*
1616

17-
permissions:
18-
contents: write
17+
env:
18+
COMPONENTS: '["gooddata-api-client","gooddata-pandas","gooddata-fdw","gooddata-sdk","gooddata-dbt","gooddata-flight-server","gooddata-flexconnect","gooddata-pipelines"]'
1919

2020
jobs:
21+
matrix-components:
22+
name: Prepare matrix components
23+
runs-on: ubuntu-latest
24+
outputs:
25+
components: ${{ steps.export.outputs.components }}
26+
steps:
27+
- name: Export components JSON
28+
id: export
29+
run: echo "components=${COMPONENTS}" >> "$GITHUB_OUTPUT"
30+
2131
build:
2232
name: Build all components
33+
needs: matrix-components
34+
permissions:
35+
contents: read
2336
strategy:
2437
matrix:
25-
component:
26-
- gooddata-api-client
27-
- gooddata-pandas
28-
- gooddata-fdw
29-
- gooddata-sdk
30-
- gooddata-dbt
31-
- gooddata-flight-server
32-
- gooddata-flexconnect
33-
- gooddata-pipelines
38+
component: ${{ fromJSON(needs.matrix-components.outputs.components) }}
3439
runs-on: ubuntu-latest
3540
steps:
3641
- uses: actions/checkout@v4
@@ -55,6 +60,8 @@ jobs:
5560
name: Create GitHub release
5661
runs-on: ubuntu-latest
5762
needs: build
63+
permissions:
64+
contents: write
5865
steps:
5966
- name: Obtain artifacts
6067
uses: actions/download-artifact@v4
@@ -83,18 +90,14 @@ jobs:
8390
publish:
8491
name: Publish components
8592
runs-on: ubuntu-latest
86-
needs: build
93+
needs:
94+
- matrix-components
95+
- build
96+
permissions:
97+
id-token: write
8798
strategy:
8899
matrix:
89-
component:
90-
- gooddata-api-client
91-
- gooddata-pandas
92-
- gooddata-fdw
93-
- gooddata-sdk
94-
- gooddata-dbt
95-
- gooddata-flight-server
96-
- gooddata-flexconnect
97-
- gooddata-pipelines
100+
component: ${{ fromJSON(needs.matrix-components.outputs.components) }}
98101
steps:
99102
- name: Obtain ${{ matrix.component }} artifacts
100103
uses: actions/download-artifact@v4
@@ -104,8 +107,6 @@ jobs:
104107
- name: Push ${{ matrix.component}} to pypi
105108
uses: pypa/gh-action-pypi-publish@release/v1
106109
with:
107-
user: __token__
108-
password: ${{ secrets.PYPI_API_TOKEN }}
109110
packages-dir: dist/${{ matrix.component }}
110111
verbose: true
111112
slack-notification:

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040

4141
## Maintenance Tasks
4242

43+
### Adding a New Package
44+
45+
When adding a new distributable package to this monorepo, update release automation and PyPI configuration together:
46+
47+
1. Add the package name to `COMPONENTS` in:
48+
- `.github/workflows/dev-release.yaml`
49+
- `.github/workflows/build-release.yaml`
50+
2. Verify the package is built by release workflows and artifacts are uploaded from its `dist/` directory.
51+
3. Configure the package on PyPI to use Trusted Publisher for this repository/workflow combination.
52+
4. Run/observe a release workflow and confirm publishing succeeds via OIDC (no `PYPI_API_TOKEN` required).
53+
4354
### Adding Support for a New Python Version
4455

4556
When adding support for a new Python version:

0 commit comments

Comments
 (0)