-
Notifications
You must be signed in to change notification settings - Fork 7
133 lines (108 loc) · 3.73 KB
/
release-builder.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
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
name: Release builder
on:
push:
branches:
- master
workflow_dispatch:
inputs:
force_publish:
description: Force publish
type: boolean
force_pr:
description: Force pull request
type: boolean
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
detect_release:
name: Detect release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- id: tag
uses: salsify/action-detect-and-tag-new-version@v2
with:
tag-annotation-template: |
chore(release): {VERSION}
version-command: |
cat worf/__init__.py | cut -d = -f 2 | xargs | cut -d v -f 2
outputs:
created_tag: ${{ steps.tag.outputs.tag }}
current_version: ${{ steps.tag.outputs.current-version }}
previous_version: ${{ steps.tag.outputs.previous-version }}
publish_release:
if: inputs.force_publish || needs.detect_release.outputs.created_tag
name: Publish release
runs-on: ubuntu-latest
needs: detect_release
env:
GITHUB_TOKEN: ${{ github.token }}
PROJECT_NAME: worf
PROJECT_TYPE: package
RELEASE_FAILURE_ICON: ${{ vars.RELEASE_BUILDER_FAILURE_ICON }}
RELEASE_PENDING_ICON: ${{ vars.RELEASE_BUILDER_PENDING_ICON }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_SIX_BOT_TOKEN }}
SLACK_CHANNEL: ${{ vars.SLACK_CHANNEL }}
TARGET_NAME: pypi.org
TARGET_URL: https://pypi.org/project/worf/
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: message
uses: gundotio/release-builder/slack-message@v1
with:
channel-id: ${{ env.SLACK_CHANNEL }}
- run: script/build
- run: script/start
- id: build
run: script/package --build
- run: script/package --dry-run
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }}
- id: release
run: script/package --release
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- if: always()
uses: gundotio/release-builder/slack-message@v1
with:
channel-id: ${{ steps.message.outputs.channel-id }}
message-id: ${{ steps.message.outputs.message-id }}
status: ${{ steps.release.conclusion }}
build_changelog:
if: always() && needs.publish_release.result != 'failure'
name: Build changelog
runs-on: ubuntu-latest
needs: publish_release
steps:
- uses: actions/checkout@v3
- id: changelog
uses: gundotio/release-builder/build-changelog@v1
outputs:
has_prs: ${{ steps.changelog.outputs.has_prs }}
previous_version: ${{ steps.changelog.outputs.previous_version }}
next_version: ${{ steps.changelog.outputs.next_version }}
notes: ${{ steps.changelog.outputs.notes }}
release: ${{ steps.changelog.outputs.release }}
create_pr:
if: always() && inputs.force_pr || needs.build_changelog.outputs.has_prs
name: Create pull request
runs-on: ubuntu-latest
needs: build_changelog
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- run: pipx install poetry
- run: poetry version ${{ needs.build_changelog.outputs.next_version }}
- run: echo '__version__ = "${{ needs.build_changelog.outputs.next_version }}"' > worf/__init__.py
- uses: gundotio/release-builder/pull-request@v1
with:
next_version: ${{ needs.build_changelog.outputs.next_version }}
notes: ${{ needs.build_changelog.outputs.notes }}
previous_version: ${{ needs.build_changelog.outputs.previous_version }}
release: ${{ needs.build_changelog.outputs.release }}