v0.4.4 #315
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Install XCB dependencies | |
| run: sudo apt-get update && sudo apt-get install -y libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev | |
| - name: Check formatting | |
| run: cargo fmt --check | |
| - name: Lint | |
| run: cargo clippy -- -D warnings | |
| - name: Run tests | |
| run: cargo test | |
| - name: Check dependencies | |
| uses: EmbarkStudios/cargo-deny-action@v2 | |
| build: | |
| needs: check | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: filectrl-linux | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: filectrl-macos | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: filectrl-macos-arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install XCB dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt-get update && sudo apt-get install -y libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev | |
| - name: Add Rust target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: target/${{ matrix.target }}/release/filectrl | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Delete previous dev release | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| gh release delete dev --yes || true | |
| git push --delete origin refs/tags/dev || true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir release-assets | |
| cp artifacts/filectrl-linux/filectrl release-assets/filectrl-linux | |
| cp artifacts/filectrl-macos/filectrl release-assets/filectrl-macos | |
| cp artifacts/filectrl-macos-arm64/filectrl release-assets/filectrl-macos-arm64 | |
| - name: Create release | |
| uses: softprops/action-gh-release@v3 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref == 'refs/heads/main' && 'dev' || github.ref_name }} | |
| name: ${{ github.ref == 'refs/heads/main' && 'dev' || github.ref_name }} | |
| body: ${{ github.ref == 'refs/heads/main' && 'Latest build from main branch' || '' }} | |
| make_latest: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }} | |
| files: | | |
| release-assets/filectrl-linux | |
| release-assets/filectrl-macos | |
| release-assets/filectrl-macos-arm64 |