@@ -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 }}
0 commit comments