-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (138 loc) · 4.18 KB
/
cd.yml
File metadata and controls
146 lines (138 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: CD
on:
workflow_run:
workflows: [ "CI" ]
types:
- completed
workflow_dispatch: {}
permissions:
contents: write
packages: write
id-token: write
actions: read
attestations: write
env:
PYTHON_VERSION: "3.12"
jobs:
download-distribution:
name: Download Package Distribution
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v8
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: Verify downloaded files
run: |
echo "Downloaded files:"
ls -R dist/
if [ ! -d "dist" ] || [ -z "$(ls -A dist)" ]; then
echo "Artifact 'python-package-distributions-${{ github.event.workflow_run.head_sha }}' not found or is empty."
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@v8
# 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@v8
# 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 }}