Skip to content

Commit f90c102

Browse files
author
Adam McKee
committed
updating workflows
1 parent c0b53fb commit f90c102

File tree

10 files changed

+129
-98
lines changed

10 files changed

+129
-98
lines changed

.github/workflows/changelog_check.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/changelog_get.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
semver-bump:
88
description: Semver bump release type
99
type: choice
10+
default: alpha
1011
options:
1112
- ""
1213
- major
@@ -25,24 +26,33 @@ concurrency: publish
2526
jobs:
2627
check-build-params:
2728
runs-on: ubuntu-latest
29+
outputs:
30+
prerelease: ${{ contains(fromJSON('["rc", "beta", "alpha"]'), inputs.semver-bump) && 'true' || 'false' }}
2831
steps:
29-
- if: inputs.semver-bump == '' && inputs.release-version == ''
30-
run: exit 1
31-
- if: inputs.semver-bump != '' && inputs.release-version != ''
32-
run: exit 1
33-
- uses: actions/checkout@v4
34-
- name: check changelogs
35-
run: |
36-
./.github/workflows/changelog_check.sh cli/CHANGELOG.md
37-
./.github/workflows/changelog_check.sh git/CHANGELOG.md
32+
- name: one of inputs
33+
if: inputs.semver-bump == '' && inputs.release-version == ''
34+
run: exit 1
35+
- name: only one of inputs
36+
if: inputs.semver-bump != '' && inputs.release-version != ''
37+
run: exit 1
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 23
42+
- run: npm i -g @eighty4/changelog
43+
- name: check cli changelog
44+
if: inputs.semver-bump !== 'alpha' && inputs.semver-bump !== 'beta'
45+
run: changelog check --changelog-file cli/CHANGELOG.md
46+
- name: check git changelog
47+
if: inputs.semver-bump !== 'alpha' && inputs.semver-bump !== 'beta'
48+
run: changelog check --changelog-file git/CHANGELOG.md
3849

3950
verify:
40-
needs: [check-build-params]
4151
uses: ./.github/workflows/verify.yml
4252

4353
publish-cargo-crates:
4454
runs-on: ubuntu-latest
45-
needs: verify
55+
needs: [check-build-params, verify]
4656
permissions:
4757
contents: write
4858
steps:
@@ -73,13 +83,25 @@ jobs:
7383
tag: ${{ steps.version.outputs.tag }}
7484
version: ${{ steps.version.outputs.version }}
7585

86+
create-release-notes:
87+
needs: [check-build-params, publish-cargo-crates]
88+
uses: ./.github/workflows/release_notes.yml
89+
with:
90+
git_tag: ${{ needs.publish-cargo-crates.outputs.tag }}
91+
crate_version: ${{ needs.publish-cargo-crates.outputs.version }}
92+
package_path: cli
93+
prerelease: ${{ needs.check-build-params.outputs.prerelease == 'true' }}
94+
7695
create-gh-release:
77-
needs: [verify, publish-cargo-crates]
96+
needs: [check-build-params, verify, create-release-notes, publish-cargo-crates]
7897
secrets: inherit
7998
permissions:
8099
contents: write
81100
uses: ./.github/workflows/gh_release.yml
82101
with:
102+
title: 'Maestro v${{ needs.publish-cargo-crates.outputs.version }}'
103+
artifacts_path: artifacts
104+
release_notes: ${{ needs.create-release-notes.outputs.notes }}
83105
tag: ${{ needs.publish-cargo-crates.outputs.tag }}
84-
version: ${{ needs.publish-cargo-crates.outputs.version }}
85-
prerelease: ${{ contains(fromJSON('["rc", "beta", "alpha"]'), inputs.semver-bump) && 'true' || 'false' }}
106+
latest: ${{ needs.check-build-params.outputs.prerelease == 'true' && 'false' || 'true' }}
107+
prerelease: ${{ needs.check-build-params.outputs.prerelease }}

.github/workflows/create_gh_release.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/gh_release.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
1-
name: GH Release
1+
name: GitHub Release
22
run-name: Create ${{ inputs.tag }} GitHub release
33

44
on:
55
workflow_call:
66
inputs:
7+
title:
8+
type: string
9+
required: true
10+
release_notes:
11+
type: string
12+
required: true
713
prerelease:
814
type: string
915
required: true
10-
tag:
16+
latest:
1117
type: string
1218
required: true
13-
version:
19+
tag:
1420
type: string
1521
required: true
22+
artifacts_path:
23+
type: string
1624

1725
jobs:
1826
create-gh-release:
19-
runs-on: ubuntu-22.04
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: write
2030
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
ref: ${{ inputs.tag }}
24-
- uses: actions/download-artifact@v4
31+
- if: inputs.artifacts_path != ''
32+
uses: actions/download-artifact@v4
2533
with:
26-
path: artifacts
34+
path: ${{ inputs.artifacts_path }}
2735
merge-multiple: true
28-
- name: Create release
29-
run: ./.github/workflows/create_gh_release.sh ./artifacts
36+
- name: create github release
3037
env:
3138
GH_TOKEN: ${{ github.token }}
32-
CHANGELOG: ${{ inputs.prerelease == 'true' && 'Unreleased' || inputs.version }}
33-
VERSION: ${{ inputs.version }}
34-
TAG: ${{ inputs.tag }}
35-
PRERELEASE: ${{ inputs.prerelease }}
39+
run: |
40+
echo "${{ inputs.release_notes }}" | base64 --decode > release_notes.md
41+
_assets=$(ls ${{ inputs.artifact_path }})
42+
gh release create "${{ inputs.tag }}" \
43+
--repo="${{ github.repository }}" \
44+
--latest="${{ inputs.latest }}" \
45+
--prerelease="${{ inputs.prerelease }}" \
46+
--notes-file release_notes.md \
47+
--title "${{ inputs.title }}" \
48+
$_assets
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Create release notes
2+
run-name: Create ${{ inputs.git_tag }} release notes
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
package_path:
8+
type: string
9+
required: true
10+
crate_version:
11+
type: string
12+
required: true
13+
git_tag:
14+
type: string
15+
required: true
16+
prerelease:
17+
type: boolean
18+
required: true
19+
outputs:
20+
notes:
21+
value: ${{ jobs.create.outputs.notes }}
22+
23+
jobs:
24+
create:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
notes: ${{ steps.notes.outputs.notes }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
fetch-tags: true
32+
ref: ${{ inputs.git_tag }}
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 23
36+
- run: npm i -g @eighty4/changelog
37+
- id: notes
38+
env:
39+
CHANGELOG_TAG: ${{ inputs.prerelease && 'Unreleased' || format('v{0}', inputs.crate_version) }}
40+
CRATE_VERSION: ${{ inputs.crate_version }}
41+
run: |
42+
echo "#### Published to crates.io as [maestro](https://crates.io/crates/maestro/$CRATE_VERSION)" >> release_notes.md
43+
echo >> release_notes.md
44+
echo "\`\`\`cargo install maestro\`\`\`" >> release_notes.md
45+
echo >> release_notes.md
46+
47+
echo "## Release notes" >> release_notes.md
48+
echo >> release_notes.md
49+
changelog get "$CHANGELOG_TAG" --changelog-file "${{ inputs.package_path }}/CHANGELOG.md" >> release_notes.md
50+
echo >> release_notes.md
51+
52+
RELEASE_NOTES=$(cat release_notes.md | base64 -w 0)
53+
echo "notes=$RELEASE_NOTES" >> "$GITHUB_OUTPUT"

cli/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Changelog
22

3-
## Unreleased
3+
## [Unreleased]
44

55
- CLI supports `--offline` flag for `maestro git` to get workspace repository statuses without syncing
66
- CLI notifies user when `--offline` mode is implicitly applied because of network availability
77

8-
## 0.2.1 - 2025-03-13
8+
## [v0.2.1] - 2025-03-13
99

1010
- CLI git prints repo state
1111

12-
## 0.2.0 - 2025-03-09
12+
## [v0.2.0] - 2025-03-09
1313

1414
- CLI performs git pull on each subdirectory repository from a workspace directory
1515
- CLI provides interactive TUI for git pulls
1616
- CLI git interactive mode launches browser with GitHub compare page
1717

1818
[Unreleased]: https://github.com/eighty4/maestro/compare/maestro-v0.2.1...HEAD
19-
[0.2.1]: https://github.com/eighty4/maestro/compare/maestro-v0.2.0...maestro-v0.2.1
20-
[0.2.0]: https://github.com/eighty4/maestro/releases/tag/maestro-v0.2.0
19+
[v0.2.1]: https://github.com/eighty4/maestro/compare/maestro-v0.2.0...maestro-v0.2.1
20+
[v0.2.0]: https://github.com/eighty4/maestro/releases/tag/maestro-v0.2.0

git/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Changelog
22

3-
## Unreleased
3+
## [Unreleased]
44

55
- Sync API supports offline flag to collect repository statuses without syncing
66
- Sync API uses DNS lookup to determine network connectivity before syncing
77

8-
## 0.2.1 - 2025-03-13
8+
## [v0.2.1] - 2025-03-13
99

1010
- Sync API collects local change and stash counts in repository
1111

12-
## 0.2.0 - 2025-03-09
12+
## [v0.2.0] - 2025-03-09
1313

1414
- Sync API parallelizes git pulls across multiple git repositories
1515
- Sync API provides RemoteHost for accessing featurs of the remote's Git services such as GitHub's ref compare page
1616

1717
[Unreleased]: https://github.com/eighty4/maestro/compare/maestro_git-v0.2.1...HEAD
18-
[0.2.1]: https://github.com/eighty4/maestro/compare/maestro_git-v0.2.0...maestro_git-v0.2.1
19-
[0.2.0]: https://github.com/eighty4/maestro/releases/tag/maestro_git-v0.2.0
18+
[v0.2.1]: https://github.com/eighty4/maestro/compare/maestro_git-v0.2.0...maestro_git-v0.2.1
19+
[v0.2.0]: https://github.com/eighty4/maestro/releases/tag/maestro_git-v0.2.0

release.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ shared-version = true
55
tag-message = "cargo release {{tag_name}}"
66

77
pre-release-replacements = [
8-
{ file = "CHANGELOG.md", search = "## Unreleased", replace = "## Unreleased\n\n## {{version}} - {{date}}", exactly = 1 },
8+
{ file = "CHANGELOG.md", search = "## \\[Unreleased\\]", replace = "## [Unreleased]\n\n- ???\n\n## [v{{version}}] - {{date}}", exactly = 1 },
99
# does not occur for first release
1010
{ file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}", min = 0, max = 1 },
1111
# only for first release
1212
{ file = "CHANGELOG.md", search = "tree/HEAD", replace = "releases/tag/{{tag_name}}", min = 0, max = 1 },
13-
{ file = "CHANGELOG.md", search = "\\[Unreleased\\]", replace = "[Unreleased]: https://github.com/eighty4/maestro/compare/{{tag_name}}...HEAD\n[{{version}}]", exactly = 1 },
13+
{ file = "CHANGELOG.md", search = "\\[Unreleased\\]:", replace = "[Unreleased]: https://github.com/eighty4/maestro/compare/{{tag_name}}...HEAD\n[v{{version}}]:", exactly = 1 },
1414
]

0 commit comments

Comments
 (0)