Skip to content

Commit 3e2369f

Browse files
authored
Merge pull request #16 from Pymetheus/develop
chore: test publishing to TestPyPI, GHCR and GitHub Releases
2 parents a1ee3c0 + 26fb9ef commit 3e2369f

2 files changed

Lines changed: 104 additions & 104 deletions

File tree

.github/workflows/cd.yml

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -44,103 +44,103 @@ jobs:
4444
exit 1
4545
fi
4646
47-
# publish-docker:
48-
# name: Build and publish Docker Image
49-
# runs-on: ubuntu-latest
50-
# needs: download-distribution
51-
#
52-
# steps:
53-
# - name: Checkout code
54-
# uses: actions/checkout@v6
55-
#
56-
# - name: Normalize repository name
57-
# id: repo
58-
# run: |
59-
# echo "repo=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
60-
#
61-
# - name: Extract version
62-
# id: meta
63-
# run: |
64-
# VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
65-
# echo "version=$VERSION" >> $GITHUB_OUTPUT
66-
#
67-
# - name: Login to GitHub Container Registry
68-
# uses: docker/login-action@v3
69-
# with:
70-
# registry: ghcr.io
71-
# username: ${{ github.actor }}
72-
# password: ${{ secrets.GITHUB_TOKEN }}
73-
#
74-
# - name: Set up Docker Buildx
75-
# uses: docker/setup-buildx-action@v3
76-
#
77-
# - name: Build and push
78-
# uses: docker/build-push-action@v6
79-
# with:
80-
# context: .
81-
# file: docker/Dockerfile
82-
# platforms: |
83-
# linux/amd64
84-
# linux/arm64
85-
# push: true
86-
# tags: |
87-
# ghcr.io/${{ steps.repo.outputs.repo }}:latest
88-
# ghcr.io/${{ steps.repo.outputs.repo }}:${{ steps.meta.outputs.version }}
89-
#
90-
# publish-test-pypi:
91-
# name: Publish to TestPyPI
92-
# runs-on: ubuntu-latest
93-
# needs: download-distribution
94-
#
95-
# environment:
96-
# name: testpypi
97-
# url: https://test.pypi.org/p/python_project_blueprint # Replace with your package name
98-
#
99-
# steps:
100-
# - name: Download build artifacts
101-
# uses: actions/download-artifact@v7
102-
# with:
103-
# name: python-package-distributions-${{ github.event.workflow_run.head_sha }}
104-
# path: dist/
105-
# run-id: ${{ github.event.workflow_run.id }}
106-
# github-token: ${{ secrets.GITHUB_TOKEN }}
107-
#
108-
# - name: Publish to TestPyPI
109-
# uses: pypa/gh-action-pypi-publish@release/v1
110-
# with:
111-
# repository-url: https://test.pypi.org/legacy/
112-
# packages-dir: dist/
113-
# skip-existing: true
114-
# verbose: true
115-
#
116-
# github-release:
117-
# name: Create GitHub Release
118-
# runs-on: ubuntu-latest
119-
# needs: [publish-docker, publish-test-pypi]
120-
#
121-
# steps:
122-
# - name: Checkout code
123-
# uses: actions/checkout@v6
124-
#
125-
# - name: Download build artifacts
126-
# uses: actions/download-artifact@v7
127-
# with:
128-
# name: python-package-distributions-${{ github.event.workflow_run.head_sha }}
129-
# path: dist/
130-
# run-id: ${{ github.event.workflow_run.id }}
131-
# github-token: ${{ secrets.GITHUB_TOKEN }}
132-
#
133-
# - name: Extract version
134-
# id: meta
135-
# run: |
136-
# VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
137-
# echo "version=$VERSION" >> $GITHUB_OUTPUT
138-
#
139-
# - name: Create GitHub release
140-
# uses: softprops/action-gh-release@v2
141-
# with:
142-
# files: dist/*
143-
# tag_name: v${{ steps.meta.outputs.version }}
144-
# generate_release_notes: true
145-
# env:
146-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
publish-docker:
48+
name: Build and publish Docker Image
49+
runs-on: ubuntu-latest
50+
needs: download-distribution
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v6
55+
56+
- name: Normalize repository name
57+
id: repo
58+
run: |
59+
echo "repo=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
60+
61+
- name: Extract version
62+
id: meta
63+
run: |
64+
VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
65+
echo "version=$VERSION" >> $GITHUB_OUTPUT
66+
67+
- name: Login to GitHub Container Registry
68+
uses: docker/login-action@v3
69+
with:
70+
registry: ghcr.io
71+
username: ${{ github.actor }}
72+
password: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Set up Docker Buildx
75+
uses: docker/setup-buildx-action@v3
76+
77+
- name: Build and push
78+
uses: docker/build-push-action@v6
79+
with:
80+
context: .
81+
file: docker/Dockerfile
82+
platforms: |
83+
linux/amd64
84+
linux/arm64
85+
push: true
86+
tags: |
87+
ghcr.io/${{ steps.repo.outputs.repo }}:latest
88+
ghcr.io/${{ steps.repo.outputs.repo }}:${{ steps.meta.outputs.version }}
89+
90+
publish-test-pypi:
91+
name: Publish to TestPyPI
92+
runs-on: ubuntu-latest
93+
needs: download-distribution
94+
95+
environment:
96+
name: testpypi
97+
url: https://test.pypi.org/p/python_project_blueprint # Replace with your package name
98+
99+
steps:
100+
- name: Download build artifacts
101+
uses: actions/download-artifact@v7
102+
with:
103+
name: python-package-distributions-${{ github.event.workflow_run.head_sha }}
104+
path: dist/
105+
run-id: ${{ github.event.workflow_run.id }}
106+
github-token: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: Publish to TestPyPI
109+
uses: pypa/gh-action-pypi-publish@release/v1
110+
with:
111+
repository-url: https://test.pypi.org/legacy/
112+
packages-dir: dist/
113+
skip-existing: true
114+
verbose: true
115+
116+
github-release:
117+
name: Create GitHub Release
118+
runs-on: ubuntu-latest
119+
needs: [publish-docker, publish-test-pypi]
120+
121+
steps:
122+
- name: Checkout code
123+
uses: actions/checkout@v6
124+
125+
- name: Download build artifacts
126+
uses: actions/download-artifact@v7
127+
with:
128+
name: python-package-distributions-${{ github.event.workflow_run.head_sha }}
129+
path: dist/
130+
run-id: ${{ github.event.workflow_run.id }}
131+
github-token: ${{ secrets.GITHUB_TOKEN }}
132+
133+
- name: Extract version
134+
id: meta
135+
run: |
136+
VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
137+
echo "version=$VERSION" >> $GITHUB_OUTPUT
138+
139+
- name: Create GitHub release
140+
uses: softprops/action-gh-release@v2
141+
with:
142+
files: dist/*
143+
tag_name: v${{ steps.meta.outputs.version }}
144+
generate_release_notes: true
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[project]
22
name = "DISTRIBUTION-NAME"
3-
version = "0.1.0"
4-
description = "[[DESCRIPTION]]"
3+
version = "0.0.2"
4+
description = "Production-ready Python project template with modern tooling, CI/CD, security, and configuration built in."
55
readme = {file = "README.md", content-type = "text/markdown"}
66
requires-python = ">=3.12"
77
license = {"file" = "LICENSE.md"}
88
authors = [
9-
{ name = "[[USERNAME]]", email = "AUTHOR@EXAMPLE.COM" }
9+
{ name = "Pymetheus", email = "github.senate902@passfwd.com" }
1010
]
1111

1212
classifiers = [
@@ -30,7 +30,7 @@ dev = [
3030
[project.urls]
3131
Homepage = "https://github.com/[[USERNAME]]/[[REPO_NAME]]"
3232
Repository = "https://github.com/[[USERNAME]]/[[REPO_NAME]]"
33-
Documentation = "https://github.com/[[USERNAME]]/[[REPO_NAME]]/blob/main/docs/DOCUMENTATION.md"
33+
Documentation = "https://github.com/[[USERNAME]]/[[REPO_NAME]]/blob/main/docs/INSTRUCTIONS.md"
3434
Issues = "https://github.com/[[USERNAME]]/[[REPO_NAME]]/issues"
3535

3636
[project.scripts]

0 commit comments

Comments
 (0)