diff options
| author | diogo464 <[email protected]> | 2022-09-23 14:12:45 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2022-09-23 14:21:20 +0100 |
| commit | 839c461fc0dddad7eeff5c2f0419f5f504e37522 (patch) | |
| tree | 7f3faf6184ff24f56cb011b7bcdd7db70092aa37 | |
| parent | 8f3b3dc4679a361f31a4d790372f2baf53a115bd (diff) | |
added github action to release binaries0.1.0
| -rw-r--r-- | .github/workflows/release.yml | 67 | ||||
| -rwxr-xr-x | prepare_binaries.sh | 13 |
2 files changed, 80 insertions, 0 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a5928d0 --- /dev/null +++ b/.github/workflows/release.yml | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | name: release | ||
| 2 | on: | ||
| 3 | push: | ||
| 4 | tags: | ||
| 5 | - "[0-9]+.[0-9]+.[0-9]+" | ||
| 6 | |||
| 7 | jobs: | ||
| 8 | build-linux: | ||
| 9 | runs-on: ubuntu-latest | ||
| 10 | |||
| 11 | steps: | ||
| 12 | - uses: actions/checkout@v3 | ||
| 13 | |||
| 14 | - name: Install latest nightly | ||
| 15 | uses: actions-rs/toolchain@v1 | ||
| 16 | with: | ||
| 17 | toolchain: nightly | ||
| 18 | override: true | ||
| 19 | |||
| 20 | - name: Build binaries | ||
| 21 | run: ./prepare_binaries.sh linux | ||
| 22 | |||
| 23 | - uses: actions/upload-artifact@master | ||
| 24 | with: | ||
| 25 | name: dotup-linux-x64 | ||
| 26 | path: dotup_x86_64-unknown-linux-musl | ||
| 27 | |||
| 28 | build-macos: | ||
| 29 | runs-on: macos-12 | ||
| 30 | |||
| 31 | steps: | ||
| 32 | - uses: actions/checkout@v3 | ||
| 33 | |||
| 34 | - name: Install latest nightly | ||
| 35 | uses: actions-rs/toolchain@v1 | ||
| 36 | with: | ||
| 37 | toolchain: nightly | ||
| 38 | override: true | ||
| 39 | |||
| 40 | - name: Build binaries | ||
| 41 | run: ./prepare_binaries.sh macos | ||
| 42 | |||
| 43 | - uses: actions/upload-artifact@master | ||
| 44 | with: | ||
| 45 | name: dotup-macos-x64 | ||
| 46 | path: dotup_x86_64-apple-darwin | ||
| 47 | |||
| 48 | release: | ||
| 49 | runs-on: ubuntu-latest | ||
| 50 | needs: [build-linux, build-macos] | ||
| 51 | steps: | ||
| 52 | - name: Download linux binary | ||
| 53 | uses: actions/download-artifact@master | ||
| 54 | with: | ||
| 55 | name: dotup-linux-x64 | ||
| 56 | path: . | ||
| 57 | |||
| 58 | - name: Download macos binary | ||
| 59 | uses: actions/download-artifact@master | ||
| 60 | with: | ||
| 61 | name: dotup-macos-x64 | ||
| 62 | path: . | ||
| 63 | |||
| 64 | - name: Release | ||
| 65 | uses: softprops/action-gh-release@v1 | ||
| 66 | with: | ||
| 67 | files: dotup_* | ||
diff --git a/prepare_binaries.sh b/prepare_binaries.sh new file mode 100755 index 0000000..ad74552 --- /dev/null +++ b/prepare_binaries.sh | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | if [ "$1" = "linux" ]; then | ||
| 4 | rustup target install x86_64-unknown-linux-musl || exit 1 | ||
| 5 | cargo build --target-dir target/ --target x86_64-unknown-linux-musl --release || exit 1 | ||
| 6 | mv target/x86_64-unknown-linux-musl/release/dotup "dotup_x86_64-unknown-linux-musl" | ||
| 7 | fi | ||
| 8 | |||
| 9 | if [ "$1" = "macos" ]; then | ||
| 10 | rustup target install x86_64-apple-darwin || exit 1 | ||
| 11 | cargo build --target-dir target/ --target x86_64-apple-darwin --release || exit 1 | ||
| 12 | mv target/x86_64-apple-darwin/release/dotup "dotup_x86_64-apple-darwin" | ||
| 13 | fi | ||
