Skip to content

Commit c47789c

Browse files
committed
feat: update CI workflow to publish to PyPI and Docker with inputs and secrets
1 parent d8895dc commit c47789c

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

.github/workflows/CI.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,22 @@ jobs:
151151
release:
152152
name: Release
153153
runs-on: ubuntu-latest
154-
if: "startsWith(github.ref, 'refs/tags/')"
155154
needs: [linux, musllinux, windows, macos, sdist]
156155
steps:
157156
- uses: actions/download-artifact@v4
158-
- name: Publish to PyPI
157+
- name: Publish to PyPI If ref/tags/v* is pushed
158+
if: "startsWith(github.ref, 'refs/tags/')"
159159
uses: PyO3/maturin-action@v1
160160
env:
161161
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
162162
with:
163163
command: upload
164164
args: --non-interactive --skip-existing wheels-*/*
165+
- name: Publish to PyPI If workflow_dispatch is triggered
166+
if: github.event_name == "workflow_dispatch"
167+
uses: PyO3/maturin-action@v1
168+
env:
169+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
170+
with:
171+
command: upload
172+
args: --non-interactive --skip-existing wheels-*/*

.github/workflows/publish-docker.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ on:
99
- 'v*'
1010
workflow_dispatch:
1111
inputs:
12-
tags:
13-
description: 'The tag to publish manually'
12+
version:
13+
description: 'The version to publish manually'
1414
required: true
1515
default: 'latest'
1616

1717
# This creates an environment variable called `IMAGE_NAME ` with the value `ghtoken_product_demo`.
1818
env:
19-
IMAGE_NAME: retrofor/iamai-prod
19+
IMAGE_NAME: iamai-prod
2020
#
2121
jobs:
2222
# This pushes the image to GitHub Packages.
@@ -42,11 +42,16 @@ jobs:
4242
# This changes all uppercase characters to lowercase.
4343
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
4444
# This strips the git ref prefix from the version.
45-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
45+
if [ -n "${{ github.event.inputs.version }}" ]; then
46+
VERSION=${{ github.event.inputs.version }}
47+
else
48+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
49+
fi
50+
4651
# This strips the "v" prefix from the tag name.
4752
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
4853
# This uses the Docker `latest` tag convention.
49-
[ "$VERSION" == "main" ] && VERSION=latest
54+
[ "$VERSION" == "master" ] && VERSION=latest
5055
echo IMAGE_ID=$IMAGE_ID
5156
echo VERSION=$VERSION
5257
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION

0 commit comments

Comments
 (0)