-
Notifications
You must be signed in to change notification settings - Fork 18
75 lines (67 loc) · 2.14 KB
/
cd.yml
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
########[CD PIPELINE FLOW]########
# Run ci_succeed: #
# | failure ~> stop. #
# | pass: #
# Run create_release: #
# | failure ~> stop. #
# | pass: #
# Run publish. #
##################################
# Requiered Github secrets: #
# - GITHUB_TOKEN #
# - PYPI_TOKEN #
##################################
name: CD
on:
push:
tags:
- "v*.*.*"
jobs:
ci_succeed:
name: Check CI Status
runs-on: ubuntu-latest
steps:
- uses: hadialqattan/[email protected]
with:
workflow: CI
create_release:
name: Create Release
needs: ci_succeed
runs-on: ubuntu-latest
steps:
- name: Get version from tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
shell: bash
- name: Checkout code
uses: actions/checkout@v4
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.tag_name.outputs.current_version }}
path: ./docs/CHANGELOG.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the "Get Changelog Entry" step above,
# referencing it's ID to get its outputs object.
tag_name: v${{ steps.changelog_reader.outputs.version }}
release_name: v${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
publish:
name: Build & Publish
needs: [ci_succeed, create_release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}