33on :
44 pull_request :
55 push :
6- branches : [main, master]
6+ branches : [ main, master ]
77
88env :
99 RUSTFLAGS : " -C debuginfo=0 -D warnings"
1818 strategy :
1919 fail-fast : false
2020 matrix :
21- os : [macos-latest, windows-latest, ubuntu-latest]
22- toolchain : [stable, beta, nightly]
21+ os : [ macos-latest, windows-latest, ubuntu-latest ]
22+ toolchain : [ stable, beta, nightly ]
2323 include :
2424 - os : macos-latest
2525 MACOS : true
@@ -28,14 +28,11 @@ jobs:
2828 steps :
2929 - uses : actions/checkout@v4
3030
31- - name : install linux deps
32- run : |
33- sudo apt update
34- sudo apt install -y --no-install-recommends libasound2-dev pkg-config
31+ - name : Install linux build requirements
32+ run : sudo apt install --yes --no-install-recommends libasound2-dev pkg-config
3533 if : contains(matrix.os, 'ubuntu')
3634
3735 - name : install ${{ matrix.toolchain }} toolchain
38- id : install_toolchain
3936 run : rustup toolchain install ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
4037
4138 - run : cargo clippy -- -D warnings
5552 # Check minimal build. `tests/seek.rs` fails if there are no decoders at all,
5653 # adding one to make the tests check pass.
5754 - run : cargo check --tests --lib --no-default-features --features mp3
58- cargo-publish :
59- if : github.event_name == 'push' && github.ref == 'refs/heads/master'
60- env :
61- CRATESIO_TOKEN : ${{ secrets.CRATESIO_TOKEN }}
62- runs-on : ubuntu-latest
63- steps :
64- - uses : actions/checkout@v4
65- - name : Update apt
66- run : sudo apt update
67- - name : Install alsa
68- run : sudo apt install -y --no-install-recommends libasound2-dev pkg-config
69- - name : Run cargo publish for rodio
70- continue-on-error : true
71- run : |
72- RODIO_TMP=$(mktemp /tmp/rodioXXX.txt) || echo "::error::mktemp error"
73- echo "RODIO_TMP=$RODIO_TMP" >> $GITHUB_ENV
74- cargo publish --token $CRATESIO_TOKEN 2> $RODIO_TMP
75- - name : Check if rodio is already published
76- run : |
77- empty=0
78- RODIO_TMP="${{ env.RODIO_TMP }}"
79- grep -q '[^[:space:]]' < $RODIO_TMP || empty=1
80- [ $empty -eq 0 ] && cat $RODIO_TMP
81- [ $empty -eq 1 ] || grep -q "is already uploaded" < $RODIO_TMP
82-
83- create-git-tag :
84- if : github.event_name == 'push' && github.ref == 'refs/heads/master'
85- runs-on : ubuntu-latest
86- steps :
87- - name : Check if WORKFLOW_TOKEN is set
88- run : |
89- if [ -z "${{ secrets.WORKFLOW_TOKEN }}" ]; then
90- echo "Personal access token WORKFLOW_TOKEN is not set"
91- exit 1
92- else
93- echo "Checked `WORKFLOW_TOKEN` is set"
94- fi
95- - name : Checkout code
96- uses : actions/checkout@v4
97- with :
98- fetch-depth : 0 # Fetch all history to list all existing tags
99- token : ${{ secrets.WORKFLOW_TOKEN }}
100- - name : Extract version from Cargo.toml
101- id : extract_version
102- run : |
103- version=$(awk '/\[package\]/,/^version/ { if ($1 == "version") { gsub(/"/, "", $3); print $3 } }' Cargo.toml)
104- echo "Version value found: $version"
105- echo "version=$version" >> $GITHUB_OUTPUT
106- - name : Check if tag exists
107- id : check_tag
108- run : |
109- version=${{ steps.extract_version.outputs.version }}
110- version_name="v$version"
111- if git rev-parse "refs/tags/$version_name" >/dev/null 2>&1; then
112- echo "Tag $version_name already exists"
113- echo "tag_exists=true" >> $GITHUB_OUTPUT
114- else
115- echo "Tag $version_name does not exist"
116- echo "tag_exists=false" >> $GITHUB_OUTPUT
117- fi
118- - name : Create and push tag
119- if : steps.check_tag.outputs.tag_exists == 'false'
120- run : |
121- version=${{ steps.extract_version.outputs.version }}
122- git config --global user.name 'github-actions'
123- git config --global user.email '[email protected] ' 124- version_name="v$version"
125- git tag -a "$version_name" -m "Release for $version_name"
126- git push origin $version_name
0 commit comments