Skip to content

Commit af9e67c

Browse files
committed
separate steps for platforms
1 parent 8f4955c commit af9e67c

1 file changed

Lines changed: 71 additions & 12 deletions

File tree

.github/workflows/release-cli.yaml

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,57 @@ jobs:
2525
draft: false
2626
prerelease: false
2727

28-
build:
29-
name: Release Artifacts
28+
build-linux:
29+
name: Release Artifacts on Linux
3030
needs:
3131
- create-release
3232
strategy:
3333
matrix:
3434
box:
35-
- { runner: ubuntu-20.04, os-and-arch: linux-amd64, content-type: gzip, extension: tar.gz }
36-
- { runner: arm-runner, os-and-arch: linux-arm64, content-type: gzip, extension: tar.gz }
37-
- { runner: macos-12, os-and-arch: macos-amd64, content-type: gzip, extension: tar.gz }
38-
- { runner: windows-2022, os-and-arch: windows-amd64, content-type: zip, extension: zip }
35+
- { runner: ubuntu-20.04, os-and-arch: linux-amd64 }
36+
- { runner: arm-runner, os-and-arch: linux-arm64 }
3937
runs-on: ${{ matrix.box.runner }}
4038
timeout-minutes: 45
4139
steps:
4240
- name: Install dependencies
43-
if: ${{ matrix.box.os-and-arch == 'linux-amd64' || matrix.box.os-and-arch == 'linux-arm64' }}
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y --no-install-recommends curl build-essential libssl-dev pkg-config
44+
45+
- name: Install Rust Toolchain
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
profile: minimal
49+
toolchain: stable
50+
51+
- uses: actions/checkout@v3
52+
- name: Build and Package
53+
run: |
54+
cd cli
55+
cargo build --release
56+
cd ./target/release && tar -czvf dbdev.tar.gz ./dbdev
57+
58+
- name: Get Upload Url
59+
run: echo UPLOAD_URL=$(curl --silent https://api.github.com/repos/${{ github.repository }}/releases/latest | jq .upload_url --raw-output) >> $GITHUB_ENV
60+
61+
- name: Upload Release Asset
62+
uses: actions/upload-release-asset@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
upload_url: ${{ env.UPLOAD_URL }}
67+
asset_path: ./cli/target/release/dbdev.tar.gz
68+
asset_name: dbdev-${{ github.ref_name }}-${{ matrix.box.os-and-arch }}.tar.gz
69+
asset_content_type: application/gzip
70+
71+
build-macos:
72+
name: Release Artifacts on macOS
73+
needs:
74+
- create-release
75+
runs-on: macos-12
76+
timeout-minutes: 45
77+
steps:
78+
- name: Install dependencies
4479
run: |
4580
sudo apt-get update
4681
sudo apt-get install -y --no-install-recommends curl build-essential libssl-dev pkg-config
@@ -53,15 +88,39 @@ jobs:
5388

5489
- uses: actions/checkout@v3
5590
- name: Build and Package on Unix
56-
if: ${{ matrix.box.os-and-arch != 'windows-amd64' }}
5791
run: |
5892
cd cli
5993
cargo build --release
6094
cd ./target/release && tar -czvf dbdev.tar.gz ./dbdev
6195
96+
- name: Get Upload Url
97+
run: echo UPLOAD_URL=$(curl --silent https://api.github.com/repos/${{ github.repository }}/releases/latest | jq .upload_url --raw-output) >> $GITHUB_ENV
98+
99+
- name: Upload Release Asset
100+
uses: actions/upload-release-asset@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
upload_url: ${{ env.UPLOAD_URL }}
105+
asset_path: ./cli/target/release/dbdev.tar.gz
106+
asset_name: dbdev-${{ github.ref_name }}-macos-amd64.tar.gz
107+
asset_content_type: application/${{ matrix.box.content-type }}
108+
109+
build-windows:
110+
name: Release Artifacts on Windows
111+
needs:
112+
- create-release
113+
runs-on: windows-2022
114+
timeout-minutes: 45
115+
steps:
116+
- name: Install Rust Toolchain
117+
uses: actions-rs/toolchain@v1
118+
with:
119+
profile: minimal
120+
toolchain: stable
121+
62122
- uses: actions/checkout@v3
63123
- name: Build and Package on Windows
64-
if: ${{ matrix.box.os-and-arch == 'windows-amd64' }}
65124
run: |
66125
cd cli
67126
cargo build --release
@@ -76,6 +135,6 @@ jobs:
76135
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77136
with:
78137
upload_url: ${{ env.UPLOAD_URL }}
79-
asset_path: ./cli/target/release/dbdev.${{ matrix.box.extension }}
80-
asset_name: dbdev-${{ github.ref_name }}-${{ matrix.box.os-and-arch }}.${{ matrix.box.extension }}
81-
asset_content_type: application/${{ matrix.box.content-type }}
138+
asset_path: ./cli/target/release/dbdev.zip
139+
asset_name: dbdev-${{ github.ref_name }}-windows-amd64.zip
140+
asset_content_type: application/zip

0 commit comments

Comments
 (0)