Skip to content

Commit 2c7e7f0

Browse files
committed
build on windows
1 parent 3c42dfd commit 2c7e7f0

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

.github/workflows/release-cli.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ jobs:
3232
strategy:
3333
matrix:
3434
box:
35-
- { runner: ubuntu-20.04, os-and-arch: linux-amd64 }
36-
- { runner: arm-runner, os-and-arch: linux-arm64 }
37-
- { runner: macos-12, os-and-arch: macos-amd64 }
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 }
3839
runs-on: ${{ matrix.box.runner }}
3940
timeout-minutes: 45
4041
steps:
@@ -44,17 +45,28 @@ jobs:
4445
sudo apt-get update
4546
sudo apt-get install -y --no-install-recommends curl build-essential libssl-dev pkg-config
4647
48+
- name: Install Rust Toolchain
49+
uses: actions-rs/toolchain@v1
50+
with:
51+
profile: minimal
52+
toolchain: stable
53+
4754
- uses: actions/checkout@v3
4855
- name: Build
4956
run: |
50-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable
51-
source "$HOME/.cargo/env"
52-
rustup --version && rustc --version && cargo --version
53-
5457
cd cli
5558
cargo build --release
59+
60+
- name: Package on Unix
61+
if: ${{ matrix.box.os-and-arch != 'windows-amd64' }}
62+
run: |
5663
cd ./target/release && tar -czvf dbdev.tar.gz ./dbdev
5764
65+
- name: Package on Windows
66+
if: ${{ matrix.box.os-and-arch == 'windows-amd64' }}
67+
run: |
68+
cd ./target/release && Compress-Archive -Path ./dbdev -Destination dbdev.zip
69+
5870
- name: Get Upload Url
5971
run: echo UPLOAD_URL=$(curl --silent https://api.github.com/repos/${{ github.repository }}/releases/latest | jq .upload_url --raw-output) >> $GITHUB_ENV
6072

@@ -64,6 +76,6 @@ jobs:
6476
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6577
with:
6678
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
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 }}

0 commit comments

Comments
 (0)