diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 184e152..970be89 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -44,103 +44,103 @@ jobs: exit 1 fi -# publish-docker: -# name: Build and publish Docker Image -# runs-on: ubuntu-latest -# needs: download-distribution -# -# steps: -# - name: Checkout code -# uses: actions/checkout@v6 -# -# - name: Normalize repository name -# id: repo -# run: | -# echo "repo=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT -# -# - name: Extract version -# id: meta -# run: | -# VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/') -# echo "version=$VERSION" >> $GITHUB_OUTPUT -# -# - name: Login to GitHub Container Registry -# uses: docker/login-action@v3 -# with: -# registry: ghcr.io -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Build and push -# uses: docker/build-push-action@v6 -# with: -# context: . -# file: docker/Dockerfile -# platforms: | -# linux/amd64 -# linux/arm64 -# push: true -# tags: | -# ghcr.io/${{ steps.repo.outputs.repo }}:latest -# ghcr.io/${{ steps.repo.outputs.repo }}:${{ steps.meta.outputs.version }} -# -# publish-test-pypi: -# name: Publish to TestPyPI -# runs-on: ubuntu-latest -# needs: download-distribution -# -# environment: -# name: testpypi -# url: https://test.pypi.org/p/python_project_blueprint # Replace with your package name -# -# steps: -# - name: Download build artifacts -# uses: actions/download-artifact@v7 -# with: -# name: python-package-distributions-${{ github.event.workflow_run.head_sha }} -# path: dist/ -# run-id: ${{ github.event.workflow_run.id }} -# github-token: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Publish to TestPyPI -# uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# repository-url: https://test.pypi.org/legacy/ -# packages-dir: dist/ -# skip-existing: true -# verbose: true -# -# github-release: -# name: Create GitHub Release -# runs-on: ubuntu-latest -# needs: [publish-docker, publish-test-pypi] -# -# steps: -# - name: Checkout code -# uses: actions/checkout@v6 -# -# - name: Download build artifacts -# uses: actions/download-artifact@v7 -# with: -# name: python-package-distributions-${{ github.event.workflow_run.head_sha }} -# path: dist/ -# run-id: ${{ github.event.workflow_run.id }} -# github-token: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Extract version -# id: meta -# run: | -# VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/') -# echo "version=$VERSION" >> $GITHUB_OUTPUT -# -# - name: Create GitHub release -# uses: softprops/action-gh-release@v2 -# with: -# files: dist/* -# tag_name: v${{ steps.meta.outputs.version }} -# generate_release_notes: true -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish-docker: + name: Build and publish Docker Image + runs-on: ubuntu-latest + needs: download-distribution + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Normalize repository name + id: repo + run: | + echo "repo=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Extract version + id: meta + run: | + VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: docker/Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: | + ghcr.io/${{ steps.repo.outputs.repo }}:latest + ghcr.io/${{ steps.repo.outputs.repo }}:${{ steps.meta.outputs.version }} + + publish-test-pypi: + name: Publish to TestPyPI + runs-on: ubuntu-latest + needs: download-distribution + + environment: + name: testpypi + url: https://test.pypi.org/p/python_project_blueprint # Replace with your package name + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v7 + with: + name: python-package-distributions-${{ github.event.workflow_run.head_sha }} + path: dist/ + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + packages-dir: dist/ + skip-existing: true + verbose: true + + github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + needs: [publish-docker, publish-test-pypi] + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Download build artifacts + uses: actions/download-artifact@v7 + with: + name: python-package-distributions-${{ github.event.workflow_run.head_sha }} + path: dist/ + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract version + id: meta + run: | + VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + files: dist/* + tag_name: v${{ steps.meta.outputs.version }} + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 66b7668..b38e683 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "DISTRIBUTION-NAME" -version = "0.1.0" -description = "[[DESCRIPTION]]" +version = "0.0.2" +description = "Production-ready Python project template with modern tooling, CI/CD, security, and configuration built in." readme = {file = "README.md", content-type = "text/markdown"} requires-python = ">=3.12" license = {"file" = "LICENSE.md"} authors = [ - { name = "[[USERNAME]]", email = "AUTHOR@EXAMPLE.COM" } + { name = "Pymetheus", email = "github.senate902@passfwd.com" } ] classifiers = [ @@ -30,7 +30,7 @@ dev = [ [project.urls] Homepage = "https://github.com/[[USERNAME]]/[[REPO_NAME]]" Repository = "https://github.com/[[USERNAME]]/[[REPO_NAME]]" -Documentation = "https://github.com/[[USERNAME]]/[[REPO_NAME]]/blob/main/docs/DOCUMENTATION.md" +Documentation = "https://github.com/[[USERNAME]]/[[REPO_NAME]]/blob/main/docs/INSTRUCTIONS.md" Issues = "https://github.com/[[USERNAME]]/[[REPO_NAME]]/issues" [project.scripts]