-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (61 loc) · 1.7 KB
/
cd.yml
File metadata and controls
68 lines (61 loc) · 1.7 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
# This workflow will create a GitHub release with the wheel package from CI artifacts
name: CD
on:
workflow_run:
workflows: ["CI"]
types: ["completed"]
branches: ["main"]
workflow_dispatch:
jobs:
prerelease:
if: success()
name: Create PreRelease
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
package_version: ${{ steps.ci-metadata.outputs.ci_run_number }}
steps:
- name: Download artifacts from CI workflow
uses: dawidd6/action-download-artifact@v6
with:
workflow: ci.yml
workflow_conclusion: success
name: python-package-distributions
path: dist
if_no_artifact_found: fail
- name: Read Ci metadata
id: ci-metadata
run: |
RUN_NUMBER=$(cat dist/package-version.txt)
echo "ci_run_number=$RUN_NUMBER" >> $GITHUB_OUTPUT
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: "${{ steps.ci-metadata.outputs.ci_run_number }}"
files: dist/*.whl
draft: false
prerelease: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
if: success()
environment: Production
name: Create Release
runs-on: ubuntu-latest
needs: prerelease
permissions:
contents: write
steps:
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: "${{ needs.prerelease.outputs.package_version }}"
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}