Skip to content

Commit c8a204d

Browse files
ci: add package publishing workflows
ADDED WORKFLOWS: - publish-package.yml - Publishes to GitHub Packages on release - publish-docker.yml - Publishes Docker image to GHCR on release FEATURES: - Automatic publishing on release - GitHub Packages integration - Docker container registry - Semantic versioning support - Multi-tag support (latest + version) TRIGGERS: - On release published - Manual workflow dispatch REGISTRIES: - PyPI (via GitHub Packages) - GitHub Container Registry (ghcr.io) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 9c33e54 commit c8a204d

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Build and push Docker image
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: .
33+
push: true
34+
tags: |
35+
ghcr.io/${{ github.repository }}:latest
36+
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
37+
cache-from: type=gha
38+
cache-to: type=gha,mode=max
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install build tools
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install build twine
27+
28+
- name: Build package
29+
run: python -m build
30+
31+
- name: Publish to GitHub Packages
32+
env:
33+
TWINE_USERNAME: __token__
34+
TWINE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
twine upload --repository-url https://upload.pypi.org/legacy/ dist/* || true

0 commit comments

Comments
 (0)