name: Build binary on: push: tags: - v** pull_request: jobs: build: strategy: fail-fast: true matrix: job: - { os: macos-latest } - { os: ubuntu-latest } name: Build runs-on: ${{ matrix.job.os }} steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - uses: actions-rs/cargo@v1 with: command: build args: --release - name: Rename binary id: rename shell: bash run: | if [ "$RUNNER_OS" == "Linux" ]; then BIN='cgit-simple-authentication_linux_amd64' mv target/release/cgit-simple-authentication target/release/$BIN elif [ "$RUNNER_OS" == "macOS" ]; then BIN='cgit-simple-authentication_darwin_amd64' mv target/release/cgit-simple-authentication target/release/$BIN fi echo "::set-output name=bin::target/release/$BIN" - uses: actions/upload-artifact@v2 with: name: artifact path: | target/release/cgit-simple-authentication_* - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: ${{ steps.rename.outputs.bin }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}