Skip to content

Commit d32ac31

Browse files
authored
Merge pull request #4 from acutedev/publish-docker-image
Add prebuilt Docker image publishing
2 parents 938d387 + d8d953e commit d32ac31

2 files changed

Lines changed: 82 additions & 1 deletion

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: Docker tag to publish
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
push-to-registry:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Check out the repo
23+
uses: actions/checkout@v4
24+
25+
- name: Validate manual tag
26+
if: github.event_name == 'workflow_dispatch'
27+
env:
28+
REQUESTED_TAG: ${{ inputs.tag }}
29+
run: |
30+
normalized_tag=$(printf '%s' "$REQUESTED_TAG" | tr '[:upper:]' '[:lower:]')
31+
32+
if [ "$normalized_tag" = "latest" ]; then
33+
echo "Error: the tag 'latest' is reserved for stable releases and cannot be set manually."
34+
exit 1
35+
fi
36+
37+
if ! printf '%s' "$REQUESTED_TAG" | grep -Eq '^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$'; then
38+
echo "Error: invalid Docker tag. Use 1-128 characters: letters, numbers, underscores, periods, or hyphens; the first character must be a letter, number, or underscore."
39+
exit 1
40+
fi
41+
42+
- name: Log in to GitHub Container Registry
43+
uses: docker/login-action@v3
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Extract metadata for Docker
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: ghcr.io/${{ github.repository }}
54+
tags: |
55+
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
56+
type=raw,value=latest,enable=${{ github.event_name == 'release' && !github.event.release.prerelease }}
57+
type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
58+
59+
- name: Build and push Docker image
60+
uses: docker/build-push-action@v6
61+
with:
62+
context: .
63+
push: true
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,22 @@ flowchart TB
105105

106106
## Docker Quick-Start
107107

108-
Docker runs the full workflow without installing Python locally. No pre-built image is published; build from source.
108+
Docker runs the full workflow without installing Python locally. Versioned prebuilt images will be published to GitHub Container Registry when a GitHub Release is published, and `latest` will be published for stable releases. Until the first release is available, build the image locally using the commands below.
109+
110+
### Prebuilt image after the first release
111+
112+
After the first stable GitHub Release is published, the image will be available at:
113+
114+
```bash
115+
docker pull ghcr.io/acutedev/bug-triage-workflow-python:latest
116+
docker run --rm ghcr.io/acutedev/bug-triage-workflow-python:latest --help
117+
```
118+
119+
Versioned releases will also be available by tag, for example:
120+
121+
```bash
122+
docker pull ghcr.io/acutedev/bug-triage-workflow-python:v1.0.0
123+
```
109124

110125
```bash
111126
cp .env.example .env
@@ -477,6 +492,7 @@ CLI exit codes implemented in `src/main.py`:
477492
├── .env.example
478493
├── .github/
479494
│ └── workflows/
495+
│ ├── publish-image.yml
480496
│ └── tests.yml
481497
├── .gitignore
482498
├── README.md

0 commit comments

Comments
 (0)