-
Notifications
You must be signed in to change notification settings - Fork 781
CI: Add a release preparation and release workflow #1559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c2995cf
decouple versions again
photovoltex 08a9efa
add prepare-release.yml
photovoltex f6ac162
add release.yml
photovoltex d9d67ef
cleanup docs and publish.sh
photovoltex b0f8c5e
chore: change all variables into lower case
photovoltex 6adb765
chore: adjust to review
photovoltex 604550e
chore: extend instructions for github release
photovoltex 1dde323
fix: update changes crates correctly
photovoltex 921b759
ci: publish workspace on release
photovoltex d980fe3
Merge branch 'refs/heads/dev' into ci/release-flow
photovoltex f789004
chore: fixup release workflow
photovoltex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "action": "workflow_dispatch", | ||
| "inputs": { | ||
| "versionBump": "minor" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # $fragment: see possible options https://github.com/christian-draeger/increment-semantic-version/tree/1.2.3?tab=readme-ov-file#version-fragment | ||
| if [ "$fragment" = "" ]; then | ||
| fragment=$1 | ||
| fi | ||
|
|
||
| allowed_crates="protocol oauth core discovery audio metadata playback connect" | ||
|
|
||
| if [ "$fragment" = "patch" ]; then | ||
| last_tag=$(git describe --tags --abbrev=0) | ||
| awk_crates=$(echo "$allowed_crates" | tr ' ' '|') | ||
| diff_crates=$(git diff $last_tag... --stat --name-only \ | ||
| | awk '/\.(rs|proto)$/{print}' \ | ||
| | awk "/($awk_crates)\//{print}" \ | ||
| | cut -d '/' -f 1 \ | ||
| | uniq \ | ||
| | tr \\n '\ ' \ | ||
| | xargs ) | ||
| echo "upgrading the following crates: [$diff_crates]" | ||
| else | ||
| diff_crates=$allowed_crates | ||
| echo "upgrading all crates for consistency" | ||
| fi | ||
|
|
||
| # append bin so that the version of the binary is also bumped | ||
| diff_crates="$diff_crates bin" | ||
|
|
||
| # required by script as it's usually a github action | ||
| export GITHUB_OUTPUT="version.txt" | ||
| # https://github.com/christian-draeger/increment-semantic-version/tree/1.2.3 | ||
| increment_semver=$(curl https://raw.githubusercontent.com/christian-draeger/increment-semantic-version/refs/tags/1.2.3/entrypoint.sh) | ||
|
|
||
| for diff_crate in $diff_crates ; do | ||
| if [ "$diff_crate" = "bin" ]; then | ||
| toml="./Cargo.toml" | ||
| else | ||
| toml="./$diff_crate/Cargo.toml" | ||
| fi | ||
|
|
||
| from="$(cat $toml | awk "/version/{print; exit}" | cut -d\" -f 2)" | ||
|
|
||
| # execute script inline, extract result and remove output file | ||
| echo "$increment_semver" | bash /dev/stdin $from $fragment | ||
photovoltex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| to=$(cat $GITHUB_OUTPUT | cut -d= -f 2) | ||
| rm $GITHUB_OUTPUT | ||
|
|
||
| echo "upgrading [librespot-$diff_crate] from [$from] to [$to]" | ||
|
|
||
| # replace version in associated diff_crate toml | ||
| sed -i "0,/$from/{s/$from/$to/}" $toml | ||
photovoltex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if [ "$diff_crate" = "bin" ]; then | ||
| continue | ||
| fi | ||
|
|
||
| # update workspace dependency in root toml | ||
| sed -i "/librespot-$diff_crate/{s/$from/$to/}" ./Cargo.toml | ||
|
|
||
| # update related dependencies in diff_crate | ||
| for allowed_crate in $allowed_crates ; do | ||
| cat ./$allowed_crate/Cargo.toml | grep librespot-$diff_crate > /dev/null | ||
| if [ $? = 0 ]; then | ||
| sed -i "/librespot-$diff_crate/{s/$from/$to/}" ./$allowed_crate/Cargo.toml | ||
| fi | ||
| done | ||
| done | ||
|
|
||
| exit 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| --- | ||
| # test with | ||
| # act --job prepare-release --eventpath ./.github/example/prepare-release.event | ||
| name: prepare release | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| versionBump: | ||
| description: "Version bump for" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - major | ||
| - minor | ||
| - patch | ||
|
|
||
| jobs: | ||
| prepare-release: | ||
| name: Prepare release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-tags: true | ||
photovoltex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Bump versions | ||
| env: | ||
| fragment: ${{ github.event.inputs.versionBump }} | ||
| run: ./.github/scripts/bump-versions.sh | ||
|
|
||
| - name: Update Cargo.lock | ||
| run: cargo update --workspace | ||
|
|
||
| - name: Get binary version | ||
| id: get-version | ||
| run: | | ||
| VERSION=$(cat ./Cargo.toml | awk "/version/{print; exit}" | cut -d\" -f 2) | ||
| echo VERSION=$VERSION >> ${GITHUB_OUTPUT} | ||
|
|
||
| - name: Update Changelog | ||
| uses: thomaseizinger/[email protected] | ||
| with: | ||
| tag: v${{ steps.get-version.outputs.VERSION }} | ||
| version: ${{ steps.get-version.outputs.VERSION }} | ||
|
|
||
| - name: Commit version prepare | ||
| uses: stefanzweifel/git-auto-commit-action@v6 | ||
| if: ${{ !env.ACT }} | ||
photovoltex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| with: | ||
| commit_message: 'Prepare for v${{ steps.get-version.outputs.VERSION }} release' | ||
| file_pattern: '*.md *.toml *.lock' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: release.yml | ||
| on: | ||
| release: | ||
| types: | ||
| - created | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| publish-crates: | ||
| name: Publish librespot | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Cache Rust dependencies | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y libasound2-dev | ||
|
|
||
| - name: Verify librespot workspace | ||
| run: cargo publish --workspace --dry-run | ||
|
|
||
| - name: Publish librespot workspace | ||
| if: ${{ !env.ACT }} | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
| run: cargo publish --workspace --no-verify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-audio" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Paul Lietar <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-connect" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Paul Lietar <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-core" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Paul Lietar <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-discovery" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Paul Lietar <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-metadata" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Paul Lietar <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-oauth" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Nick Steel <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-playback" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Sasha Hilton <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "librespot-protocol" | ||
| version.workspace = true | ||
| version = "0.7.1" | ||
| rust-version.workspace = true | ||
| authors = ["Paul Liétar <[email protected]>"] | ||
| license.workspace = true | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.