Skip to content

Commit 9e21599

Browse files
committed
Update release.yml
1 parent 78cdb97 commit 9e21599

3 files changed

Lines changed: 49 additions & 171 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,95 @@
11
name: Release
2-
32
on:
43
push:
54
tags:
65
- "v*.*.*"
76

87
jobs:
9-
build-and-publish:
8+
create-release:
109
runs-on: ubuntu-latest
11-
env:
12-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
outputs:
11+
upload_url: ${{ steps.create_release.outputs.upload_url }}
12+
steps:
13+
- name: Create GitHub Release
14+
id: create_release
15+
uses: softprops/action-gh-release@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
tag_name: ${{ github.ref_name }}
20+
draft: false
21+
prerelease: false
22+
23+
build-and-publish:
24+
needs: create-release
1325
strategy:
1426
matrix:
1527
include:
1628
# Linux
1729
- os: ubuntu-latest
1830
target: x86_64-unknown-linux-gnu
1931
ext: tar.gz
32+
bin: coto
2033
- os: ubuntu-latest
2134
target: aarch64-unknown-linux-gnu
2235
ext: tar.gz
36+
bin: coto
2337
# macOS
2438
- os: macos-latest
2539
target: x86_64-apple-darwin
2640
ext: tar.gz
41+
bin: coto
2742
- os: macos-latest
2843
target: aarch64-apple-darwin
2944
ext: tar.gz
45+
bin: coto
3046
# Windows
3147
- os: windows-latest
3248
target: x86_64-pc-windows-msvc
3349
ext: zip
34-
50+
bin: coto.exe
51+
runs-on: ${{ matrix.os }}
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3554
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v4
55+
- uses: actions/checkout@v4
56+
57+
# for Linux only: install cross
58+
- name: Install cross
59+
if: matrix.os == 'ubuntu-latest'
60+
run: cargo install cross --locked
3861

39-
- name: Install Rust toolchain
62+
# Install Rust toolchain with the correct target
63+
- name: Setup Rust toolchain
4064
uses: actions-rs/toolchain@v1
4165
with:
4266
toolchain: stable
4367
target: ${{ matrix.target }}
4468
override: true
4569

46-
- name: Build release binary
70+
- name: Build release binary (Linux)
71+
if: matrix.os == 'ubuntu-latest'
72+
run: cross build --release --target ${{ matrix.target }}
73+
74+
- name: Build release binary (non-Linux)
75+
if: matrix.os != 'ubuntu-latest'
4776
run: cargo build --release --target ${{ matrix.target }}
4877

49-
- name: Package
78+
- name: Package (Unix)
79+
if: matrix.os != 'windows-latest'
5080
run: |
5181
mkdir -p dist
52-
BIN="coto${{ matrix.os == 'windows-latest' && '.exe' || '' }}"
5382
PACKAGE="coto-${{ matrix.target }}.${{ matrix.ext }}"
54-
if [[ "${{ matrix.ext }}" == "zip" ]]; then
55-
zip -j dist/$PACKAGE target/${{ matrix.target }}/release/$BIN
56-
else
57-
tar czf dist/$PACKAGE -C target/${{ matrix.target }}/release $BIN
58-
fi
83+
tar czf dist/$PACKAGE -C target/${{ matrix.target }}/release ${{ matrix.bin }}
5984
60-
- name: Create GitHub Release
61-
if: matrix.os == 'ubuntu-latest'
62-
uses: softprops/action-gh-release@v1
63-
with:
64-
tag_name: ${{ github.ref_name }}
65-
files: dist/*
85+
- name: Package (Windows)
86+
if: matrix.os == 'windows-latest'
87+
shell: pwsh
88+
run: |
89+
mkdir -p dist
90+
Compress-Archive -Path "target/${{ matrix.target }}/release/${{ matrix.bin }}" -DestinationPath "dist/coto-${{ matrix.target }}.${{ matrix.ext }}"
6691
67-
- name: Upload assets
68-
if: matrix.os != 'ubuntu-latest
92+
- name: Upload artifacts to release
6993
uses: softprops/action-gh-release@v1
7094
with:
7195
tag_name: ${{ github.ref_name }}

Cargo.lock

Lines changed: 0 additions & 146 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ anyhow = "1"
88
clap = { version = "4", features = ["derive"] }
99
dialoguer = "0.11.0"
1010
dirs = "5"
11-
reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"] }
11+
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "rustls-tls"] }
1212
serde = { version = "1", features = ["derive"] }
1313
serde_json = "1.0.140"
1414
toml = "0.7"

0 commit comments

Comments
 (0)