Auto merge! (merge-pr-in-all) #237
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
| on: | |
| push: | |
| branches: | |
| - "master" | |
| tags: | |
| - "v*" | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| jobs: | |
| release: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| file: http-clock | |
| output: http-clock-linux.zip | |
| - target: x86_64-pc-windows-gnu | |
| file: http-clock.exe | |
| output: http-clock-windows.zip | |
| name: release | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }} | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y gcc-mingw-w64-x86-64 | |
| - name: Get Rust toolchain | |
| id: toolchain | |
| run: | | |
| awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT" | |
| - name: install clippy | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| toolchain: ${{ steps.toolchain.outputs.toolchain }} | |
| targets: x86_64-pc-windows-gnu | |
| - name: cache dependencies | |
| uses: Swatinem/rust-cache@v2.8.2 | |
| - name: clippy check | |
| uses: sksat/action-clippy@v1.1.1 | |
| with: | |
| reporter: github-check | |
| - name: install cargo-license | |
| run: cargo install cargo-license | |
| - name: unit test | |
| run: | | |
| cargo test --no-run --locked | |
| cargo test | |
| - name: build | |
| env: | |
| TARGET: ${{ matrix.target }} | |
| run: | |
| cargo build --release --target $TARGET | |
| - env: | |
| TARGET: ${{ matrix.target }} | |
| FILE: ${{ matrix.file }} | |
| OUTPUT: ${{ matrix.output }} | |
| run: | | |
| mkdir http-clock | |
| cargo license \ | |
| --authors \ | |
| --do-not-bundle \ | |
| --avoid-dev-deps \ | |
| --avoid-build-deps \ | |
| --filter-platform $TARGET \ | |
| > http-clock/CREDITS | |
| VERSION_NAME=${GITHUB_REF##*/} | |
| if [[ $VERSION_NAME == "master" ]]; then | |
| VERSION_NAME=$(git rev-parse --short HEAD) | |
| elif [[ ${VERSION_NAME:0:1} == "v" ]]; then | |
| VERSION_NAME=${VERSION_NAME:1} | |
| fi | |
| echo "$VERSION_NAME" > http-clock/VERSION.txt | |
| cp LICENSE README.md http-clock/ | |
| cp target/$TARGET/release/$FILE http-clock/ | |
| zip -r $OUTPUT http-clock | |
| - name: pre-release | |
| uses: softprops/action-gh-release@v2.5.0 | |
| if: "! startsWith(github.ref, 'refs/tags/')" | |
| with: | |
| tag_name: nightly-${{ github.sha }} | |
| prerelease: true | |
| fail_on_unmatched_files: true | |
| files: | | |
| ${{ matrix.output }} | |
| - name: tagged-release | |
| uses: softprops/action-gh-release@v2.5.0 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| fail_on_unmatched_files: true | |
| files: | | |
| ${{ matrix.output }} |