-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.37 KB
/
register-package.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
name: Register package to GCP Artifact Registry
on:
workflow_dispatch:
push:
branches:
- main
jobs:
register:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install --upgrade pip
pip install build twine keyring keyrings.google-artifactregistry-auth
- name: Build Python package
run: |
python -m build
- name: Authenticate with GCP
uses: google-github-actions/auth@v0.5.0
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Activate service account
run: |
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
- name: Create .pypirc file
run: |
echo "[distutils]
index-servers =
${{ secrets.REPOSITORY }}
[${{ secrets.REPOSITORY }}]
repository: https://${{ secrets.LOCATION }}-python.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REPOSITORY }}/
username: _json_key_base64
password: ${{ secrets.GCP_SA_KEY_BASE64 }}" > ~/.pypirc
- name: Register package
run: |
twine upload -r ${{ secrets.REPOSITORY }} dist/* --verbose