-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
46 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -28,14 +28,11 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: install linux deps | ||
run: | | ||
sudo apt update | ||
sudo apt install -y --no-install-recommends libasound2-dev pkg-config | ||
- name: Install linux build requirements | ||
run: sudo apt install --yes --no-install-recommends libasound2-dev pkg-config | ||
if: contains(matrix.os, 'ubuntu') | ||
|
||
- name: install ${{ matrix.toolchain }} toolchain | ||
id: install_toolchain | ||
run: rustup toolchain install ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | ||
|
||
- run: cargo clippy -- -D warnings | ||
|
@@ -55,33 +52,3 @@ jobs: | |
# Check minimal build. `tests/seek.rs` fails if there are no decoders at all, | ||
# adding one to make the tests check pass. | ||
- run: cargo check --tests --lib --no-default-features --features mp3 | ||
|
||
create-git-tag: | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the code. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Fetch tags. | ||
#### FIXME Test this (it should fetch all tags without getting the history). | ||
run: git fetch --prune --unshallow --tags | ||
|
||
- name: Create a tag for current version if it does not exist yet. | ||
id: create_version_tag | ||
run: | | ||
echo "Current git commit is $(git rev-list -n 1 HEAD)." | ||
VERSION="$(yq '.package.version' Cargo.toml)" | ||
echo "Project version from Cargo.toml: $VERSION" | ||
VERSION_TAG="v$VERSION" | ||
if git tag | grep "$VERSION_TAG"; then | ||
echo "Tag $VERSION_TAG already exists at $(git rev-list -n 1 $VERSION_TAG), leaving it unchanged." | ||
else | ||
echo "Creating new tag $VERSION_TAG ..." | ||
###### FIXME Review this using https://github.com/actions/checkout | ||
###### User name and email may need to be updated. | ||
git config user.name 'github-actions' | ||
git config user.email '[email protected]' | ||
git tag --annotate "$VERSION_TAG" --message "Release version $VERSION_TAG" | ||
git push origin "$VERSION_TAG" | ||
endif |
This file contains 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,28 +1,40 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_tag: | ||
description: 'Rodio version git tag to publish.' | ||
required: true | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
cargo-publish: | ||
env: | ||
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if the git reference looks like a version tag. | ||
run: | | ||
echo "${{ inputs.version_tag }}" \ | ||
| grep --quiet "^v[0-9]\{1,2\}\.[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\?$" | ||
- uses: actions/checkout@v4 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.version_tag }} | ||
- name: Update list of apt packages. | ||
run: sudo apt update | ||
- name: Install alsa. | ||
|
||
- name: Fetch tags | ||
run: git fetch --prune --unshallow --tags | ||
|
||
- name: Install linux build requirements | ||
run: sudo apt install --yes --no-install-recommends libasound2-dev pkg-config | ||
- name: Publish rodio to crates.io. | ||
run: cargo publish --token "$CRATESIO_TOKEN" | ||
|
||
- name: Publish and tag | ||
run: | | ||
echo "Current git commit is $(git rev-list -n 1 HEAD)." | ||
VERSION="$(yq '.package.version' Cargo.toml)" | ||
echo "Project version from Cargo.toml is $VERSION" | ||
VERSION_TAG="v$VERSION" | ||
if git tag | grep --quiet "^$VERSION_TAG$"; then | ||
echo "Tag $VERSION_TAG already exists at $(git rev-list -n 1 $VERSION_TAG), not publishing the crate." | ||
exit 1 | ||
fi | ||
cargo publish --token "${{ secrets.CRATESIO_TOKEN }}" | ||
echo "Tagging current version with $VERSION_TAG ..." | ||
# The bot name and email is taken from here https://github.com/actions/checkout/pull/1707 | ||
# see also https://api.github.com/users/github-actions%5Bbot%5D | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git tag --annotate "$VERSION_TAG" --message "Release version $VERSION_TAG" | ||
git push origin "$VERSION_TAG" |
This file contains 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