ci: bump git2 from 0.20.2 to 0.20.4 in the cargo group across 1 directory #271
Workflow file for this run
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
| name: build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '**' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: full | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| meta: | |
| name: Extract crate metadata | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 | |
| - name: Extract crate information | |
| id: meta | |
| run: | | |
| cargo metadata --no-deps --format-version 1 | jq -r '"name=" + .packages[0].name' | tee -a $GITHUB_OUTPUT | |
| cargo metadata --no-deps --format-version 1 | jq -r '"version=" + .packages[0].version' | tee -a $GITHUB_OUTPUT | |
| echo "tag=${GITHUB_REF#refs/tags/}" | tee -a $GITHUB_OUTPUT | |
| outputs: | |
| name: ${{ steps.meta.outputs.name }} | |
| version: ${{ steps.meta.outputs.version }} | |
| tag: ${{ steps.meta.outputs.tag }} | |
| build: | |
| name: Build (${{ matrix.job.short_target }}) | |
| needs: [meta] | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 3 | |
| matrix: | |
| job: | |
| - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, short_target: linux-amd64 } | |
| - { os: macos-latest, target: universal2-apple-darwin, short_target: macos-universal } | |
| - { os: windows-latest, target: x86_64-pc-windows-msvc, short_target: windows-amd64 } | |
| runs-on: ${{ matrix.job.os }} | |
| steps: | |
| - name: Install build dependencies (Linux) | |
| if: matrix.job.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libudev-dev | |
| - name: Install build dependencies (Windows) | |
| if: matrix.job.os == 'windows-latest' | |
| run: | | |
| choco install zip -y | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 #v2.8.2 | |
| - name: Build | |
| run: make build-release | |
| - name: Run tests | |
| run: make test | |
| - name: Run executable | |
| run: ./target/release/display_switch --version | |
| - name: Package | |
| id: package | |
| shell: bash | |
| run: | | |
| PACKAGE_DIR="target/package" | |
| mkdir -p "$PACKAGE_DIR" | |
| PACKAGE_NAME="display_switch-v${{ needs.meta.outputs.version }}-${{ matrix.job.short_target }}.zip" | |
| PACKAGE_FILE="$PACKAGE_DIR/$PACKAGE_NAME" | |
| shopt -s extglob # To match the filename below (without any debug symbols) | |
| zip -j $PACKAGE_FILE target/release/display_switch?(.exe) README.md LICENSE | |
| echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT | |
| echo "PACKAGE_FILE=$PACKAGE_FILE" >> $GITHUB_OUTPUT | |
| if [[ ${{ matrix.job.os }} == 'macos-latest' ]]; then | |
| echo "HOMEBREW_PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT | |
| echo "HOMEBREW_PACKAGE_HASH=$(sha256 -q $PACKAGE_FILE)" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0 | |
| with: | |
| if-no-files-found: error | |
| name: ${{ steps.package.outputs.PACKAGE_NAME }} | |
| path: ${{ steps.package.outputs.PACKAGE_FILE }} | |
| - name: Release | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b #v2.5.0 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| prerelease: ${{ contains(github.ref, 'prerelease') }} | |
| generate_release_notes: true | |
| files: ${{ steps.package.outputs.PACKAGE_FILE }} | |
| outputs: | |
| packages: ${{ steps.package.outputs.PACKAGE_NAME }} | |
| homebrew_package_name: ${{ steps.package.outputs.HOMEBREW_PACKAGE_NAME }} | |
| homebrew_package_hash: ${{ steps.package.outputs.HOMEBREW_PACKAGE_HASH }} | |
| update_homebrew: | |
| name: Update Homebrew formula | |
| needs: [meta, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 | |
| - name: Update Homebrew formula | |
| uses: mislav/bump-homebrew-formula-action@56a283fa15557e9abaa4bdb63b8212abc68e655c #v3 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| formula-name: display_switch | |
| tag-name: ${{ needs.meta.outputs.tag }} | |
| homebrew-tap: haimgel/homebrew-tools | |
| download-url: https://github.com/haimgel/display-switch/releases/download/${{ needs.meta.outputs.tag }}/${{ needs.build.outputs.homebrew_package_name }} | |
| download-sha256: ${{ needs.build.outputs.homebrew_package_hash }} | |
| env: | |
| COMMITTER_TOKEN: ${{ secrets.RELEASER_GITHUB_TOKEN }} |