Release 1.0.24 #24
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
| # https://dzfrias.dev/blog/deploy-rust-cross-platform-github-actions/ | |
| # https://reemus.dev/tldr/rust-cross-compilation-github-actions | |
| name: Deploy | |
| on: | |
| push: | |
| tags: | |
| - "[0-9]+.[0-9]+.[0-9]+" | |
| env: | |
| # The project name specified in your Cargo.toml | |
| PROJECT_NAME: dns-cli | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| # Set the job to run on the platform specified by the matrix below | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| # You can add more, for any target you'd like! | |
| include: | |
| - name: linux-amd64 | |
| runner: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - name: win-amd64 | |
| runner: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - name: macos-amd64 | |
| runner: macos-latest | |
| target: x86_64-apple-darwin | |
| - name: macos-arm64 | |
| runner: macos-latest | |
| target: aarch64-apple-darwin | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: "${{ matrix.target }}" | |
| - name: Setup Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build Binary | |
| run: cargo build --verbose --locked --release --target ${{ matrix.target }} | |
| - name: Release Binary | |
| shell: bash | |
| run: | | |
| BIN_SUFFIX="" | |
| if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then | |
| BIN_SUFFIX=".exe" | |
| fi | |
| # The built binary output location | |
| BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}" | |
| # Define a better name for the final binary | |
| BIN_RELEASE="${PROJECT_NAME}${BIN_SUFFIX}" | |
| BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}" | |
| # Move the built binary where you want it | |
| mv "${BIN_OUTPUT}" "./${BIN_RELEASE}" | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| 7z a "./${BIN_RELEASE}-${{ matrix.name }}.zip" "./${BIN_RELEASE}" | |
| echo "ASSET=./${BIN_RELEASE}-${{ matrix.name }}.zip" >> $GITHUB_ENV | |
| else | |
| tar -czf "./${BIN_RELEASE}-${{ matrix.name }}.tar.gz" "./${BIN_RELEASE}" | |
| echo "ASSET=./${BIN_RELEASE}-${{ matrix.name }}.tar.gz" >> $GITHUB_ENV | |
| fi | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ env.ASSET }} | |
| body_path: ./CHANGELOG.md |