Replace visualizer image with larger version #5
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 and Release | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| bin: rust_collatz_solution | |
| archive: rust_collatz_solution-x86_64-linux-gnu.tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| bin: rust_collatz_solution.exe | |
| archive: rust_collatz_solution-windows-x86_64.zip | |
| - os: windows-latest | |
| target: i686-pc-windows-msvc | |
| bin: rust_collatz_solution.exe | |
| archive: rust_collatz_solution-windows-i686.zip | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust (${{ matrix.target }}) | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package (Linux) | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p package | |
| cp target/${{ matrix.target }}/release/${{ matrix.bin }} package/ | |
| cp README.md package/ || true | |
| tar -C package -czf ${{ matrix.archive }} . | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p package | |
| cp target/${{ matrix.target }}/release/${{ matrix.bin }} package/ | |
| cp README.md package/ || true | |
| 7z a -tzip ${{ matrix.archive }} package/* | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.archive }} | |
| path: ${{ matrix.archive }} | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [ build ] | |
| steps: | |
| - name: Compute tag variables | |
| id: vars | |
| shell: bash | |
| run: | | |
| short_sha=${GITHUB_SHA::7} | |
| echo "short_sha=$short_sha" >> "$GITHUB_OUTPUT" | |
| echo "tag=build-${short_sha}-${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}" >> "$GITHUB_OUTPUT" | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Create GitHub Release and upload assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ steps.vars.outputs.tag }} | |
| tag_name: ${{ steps.vars.outputs.tag }} | |
| draft: false | |
| prerelease: false | |
| files: dist/**/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |