Skip to content

Commit

Permalink
Add workflow for registring package
Browse files Browse the repository at this point in the history
  • Loading branch information
ykerus committed Dec 28, 2023
1 parent f9de832 commit 088693a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/register-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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@v3

- 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: 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/*
env:
REPOSITORY: ${{ secrets.REPOSITORY }}
LOCATION: ${{ secrets.LOCATION }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
GCP_SA_KEY_BASE64: ${{ secrets.GCP_SA_KEY_BASE64 }}

0 comments on commit 088693a

Please sign in to comment.