diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/build-cross.yml | 36 | ||||
| -rw-r--r-- | .github/workflows/build.yml | 59 |
2 files changed, 95 insertions, 0 deletions
diff --git a/.github/workflows/build-cross.yml b/.github/workflows/build-cross.yml new file mode 100644 index 0000000..68f08fd --- /dev/null +++ b/.github/workflows/build-cross.yml @@ -0,0 +1,36 @@ +name: Build cross binary + +on: + push: + tags: + - v** + pull_request: + +jobs: + build_aarch64: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: aarch64-unknown-linux-musl + override: true + - name: Build aarch 64 binary + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target aarch64-unknown-linux-musl --release + - run: mv target/aarch64-unknown-linux-musl/release/cgit-simple-authentication target/aarch64-unknown-linux-musl/release/cgit-simple-authentication_linux_aarch64 + - uses: actions/upload-artifact@v2 + with: + name: aarch64-artifact + path: target/aarch64-unknown-linux-musl/release/cgit-simple-authentication_linux_aarch64 + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: target/aarch64-unknown-linux-musl/release/cgit-simple-authentication_linux_aarch64 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9e7f700 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: Build binary + +on: + push: + tags: + - v** + pull_request: + +jobs: + build: + strategy: + fail-fast: true + matrix: + job: + - { os: macos-latest } + - { os: ubuntu-latest } + - { os: windows-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 + else + BIN='cgit-simple-authentication_windows_amd64.exe' + mv target/release/cgit-simple-authentication.exe 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 }}
\ No newline at end of file |
