|
1 | 1 | # This workflow runs when a version tag is pushed. |
2 | 2 | # |
3 | 3 | # - Get new tag. |
4 | | -# - If version tag: |
5 | | -# - If release condidate tag: |
6 | | -# - Build the pre-release. |
7 | | -# - Cut GitHub pre-release. |
8 | | -# - Upload wheel to pre-release. |
9 | | -# - If release tag: |
10 | | -# - Generate new CHANGELOG. |
11 | | -# - Get next semantic version. |
12 | | -# - Close old milestones. |
13 | | -# - Create new minor version milestone. |
14 | | -# - Create new major version milestone. |
15 | | -name: Version Tag Workflow |
| 4 | +# - If release condidate tag: |
| 5 | +# - Build the pre-release. |
| 6 | +# - Cut GitHub pre-release. |
| 7 | +# - Upload wheel to pre-release. |
| 8 | +name: Prerelease Tag Workflow |
16 | 9 |
|
17 | 10 | on: |
18 | 11 | push: |
19 | 12 | tags: |
20 | 13 | - 'v*' |
21 | 14 |
|
22 | 15 | jobs: |
23 | | - update_changelog: |
24 | | - name: Update Changelog |
| 16 | + cut_prerelease: |
| 17 | + name: Cut Pre-Release |
25 | 18 | runs-on: ubuntu-latest |
26 | 19 | steps: |
27 | 20 | - name: Checkout repository |
|
37 | 30 | if [[ $tag == *"-rc"* ]]; then |
38 | 31 | echo "do_prerelease=1" >> $GITHUB_ENV |
39 | 32 | fi |
40 | | - if [[ $tag != *"-rc"* ]]; then |
41 | | - echo "do_changelog=1" >> $GITHUB_ENV |
42 | | - fi |
43 | 33 | echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT |
44 | 34 | echo "New tag is: $tag" |
45 | 35 | echo "GitHub ref: ${{ github.ref }}" |
@@ -71,100 +61,3 @@ jobs: |
71 | 61 | with: |
72 | 62 | upload_url: ${{ steps.cutprerelease.outputs.upload_url }} |
73 | 63 | asset_path: ./dist/*.whl |
74 | | - |
75 | | - - name: Generate release changelog |
76 | | - uses: heinrichreimer/github-changelog-generator-action@master |
77 | | - if: ${{ env.do_changelog == 1 }} |
78 | | - with: |
79 | | - token: ${{ secrets.GITHUB_TOKEN }} |
80 | | - sinceTag: "v1.3.1" |
81 | | - excludeTagsRegex: "-rc[0-9]" |
82 | | - breakingLabel: "Breaking Changes" |
83 | | - breakingLabels: "V: major" |
84 | | - enhancementLabel: "Features" |
85 | | - enhancementLabels: "P: enhancement" |
86 | | - bugsLabel: "Bug Fixes" |
87 | | - bugLabels: "P: bug" |
88 | | - excludeLabels: "release" |
89 | | - issues: false |
90 | | - issuesWoLabels: false |
91 | | - maxIssues: 100 |
92 | | - pullRequests: true |
93 | | - prWoLabels: false |
94 | | - author: true |
95 | | - unreleased: true |
96 | | - compareLink: true |
97 | | - stripGeneratorNotice: true |
98 | | - verbose: true |
99 | | - |
100 | | - - name: Check if diff |
101 | | - if: ${{ env.do_changelog == 1 }} |
102 | | - continue-on-error: true |
103 | | - run: > |
104 | | - git diff --exit-code CHANGELOG.md && |
105 | | - (echo "### No update" && exit 1) || (echo "### Commit update") |
106 | | -
|
107 | | - - uses: EndBug/add-and-commit@v9 |
108 | | - name: Commit and push if diff |
109 | | - if: ${{ env.do_changelog == 1 }} |
110 | | - with: |
111 | | - add: CHANGELOG.md |
112 | | - message: 'chore: update CHANGELOG.md for new release' |
113 | | - author_name: GitHub Actions |
114 | | - author_email: action@github.com |
115 | | - committer_name: GitHub Actions |
116 | | - committer_email: actions@github.com |
117 | | - push: true |
118 | | - |
119 | | - manage_milestones: |
120 | | - name: Manage Milestones |
121 | | - runs-on: ubuntu-latest |
122 | | - steps: |
123 | | - - name: Checkout repository |
124 | | - uses: actions/checkout@v3 |
125 | | - with: |
126 | | - fetch-depth: 0 |
127 | | - ref: master |
128 | | - |
129 | | - - name: Get new tag |
130 | | - id: newversion |
131 | | - run: | |
132 | | - tag=${GITHUB_REF/refs\/tags\//} |
133 | | - version=$(echo $tag | sed 's/-rc[0-9]*//') |
134 | | - if [[ $tag != *"-rc"* ]]; then |
135 | | - echo "do_milestones=1" >> $GITHUB_ENV |
136 | | - echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT |
137 | | - echo "version=$(echo $version)" >> $GITHUB_OUTPUT |
138 | | - fi |
139 | | - echo "New tag is: $tag" |
140 | | - echo "New version is: $version" |
141 | | - echo "GitHub ref: ${{ github.ref }}" |
142 | | -
|
143 | | - - name: Get next semantic version |
144 | | - id: nextversion |
145 | | - if: ${{ env.do_milestones == 1 }} |
146 | | - uses: WyriHaximus/github-action-next-semvers@v1.2.1 |
147 | | - with: |
148 | | - version: ${{ steps.newversion.outputs.version }} |
149 | | - |
150 | | - - name: Close old milestone |
151 | | - if: ${{ env.do_milestones == 1 }} |
152 | | - uses: WyriHaximus/github-action-close-milestone@master |
153 | | - with: |
154 | | - number: ${{ steps.newversion.outputs.version }} |
155 | | - |
156 | | - - name: Create new minor release milestone |
157 | | - if: ${{ env.do_milestones == 1 }} |
158 | | - uses: WyriHaximus/github-action-create-milestone@v1.2.0 |
159 | | - with: |
160 | | - title: "${{ steps.nextversion.outputs.v_minor }}" |
161 | | - env: |
162 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
163 | | - |
164 | | - - name: Create new major release milestone |
165 | | - if: ${{ env.do_milestones == 1 }} |
166 | | - uses: WyriHaximus/github-action-create-milestone@v1.2.0 |
167 | | - with: |
168 | | - title: "${{ steps.nextversion.outputs.v_major }}" |
169 | | - env: |
170 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments