Skip to content

Commit 47912b4

Browse files
committed
Add linux binary. Fix version.
1 parent 4df8950 commit 47912b4

6 files changed

Lines changed: 79 additions & 8 deletions

File tree

.github/workflows/build-lint-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
toolchain: stable
3434
- name: Build
3535
run: cargo build
36+
- name: Format
37+
run: cargo fmt --check
3638
- name: Lint
3739
run: cargo clippy -- -Dwarnings
3840
- name: Test

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,33 @@ on:
66
type: string
77
description: 'Version'
88
jobs:
9+
build-x86_64-unknown-linux-gnu:
10+
name: Build (x86_64-unknown-linux-gnu)
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
toolchain: stable
18+
- name: Set Version
19+
run: ./script/version.sh ${{ inputs.version }}
20+
- name: Build
21+
run: cargo build --release --target x86_64-unknown-linux-gnu
22+
- name: Test
23+
run: ./script/test.sh target/x86_64-unknown-linux-gnu/release
24+
- name: Rename
25+
run: mv target/x86_64-unknown-linux-gnu/release/git-coauthor git-coauthor-x86_64-unknown-linux-gnu
26+
- name: Upload
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: git-coauthor-x86_64-unknown-linux-gnu
30+
path: git-coauthor-x86_64-unknown-linux-gnu
31+
- name: Upload Cargo.lock
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: Cargo.lock
35+
path: Cargo.lock
936
build-x86_64-apple-darwin:
1037
name: Build (x86_64-apple-darwin)
1138
runs-on: macos-13
@@ -15,6 +42,8 @@ jobs:
1542
- uses: actions-rs/toolchain@v1
1643
with:
1744
toolchain: stable
45+
- name: Set Version
46+
run: ./script/version.sh ${{ inputs.version }}
1847
- name: Build
1948
run: cargo build --release --target x86_64-apple-darwin
2049
- name: Test
@@ -35,6 +64,8 @@ jobs:
3564
- uses: actions-rs/toolchain@v1
3665
with:
3766
toolchain: stable
67+
- name: Set Version
68+
run: ./script/version.sh ${{ inputs.version }}
3869
- name: Build
3970
run: cargo build --release --target aarch64-apple-darwin
4071
- name: Test
@@ -51,9 +82,14 @@ jobs:
5182
needs:
5283
- build-x86_64-apple-darwin
5384
- build-aarch64-apple-darwin
85+
- build-x86_64-unknown-linux-gnu
5486
runs-on: ubuntu-latest
5587
steps:
5688
- uses: actions/checkout@v4
89+
- name: Download (x86_64-unknown-linux-gnu)
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: git-coauthor-x86_64-unknown-linux-gnu
5793
- name: Download (x86_64-apple-darwin)
5894
uses: actions/download-artifact@v4
5995
with:
@@ -62,6 +98,10 @@ jobs:
6298
uses: actions/download-artifact@v4
6399
with:
64100
name: git-coauthor-aarch64-apple-darwin
101+
- name: Download Cargo.lock
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: Cargo.lock
65105
- name: Release
66106
env:
67107
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.release-notes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- No changes
1+
- Add x86_64-unknown-linux-gnu binary.
2+
- Fix stale version returned by `git coauthor -v`.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/release.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@ fi
2222
version="$1"
2323

2424
echo "Set version to $version"
25-
if [[ "$OSTYPE" == "darwin"* ]]; then
26-
sed -i "" "s/^version = .*/version = \"$version\"/g" Cargo.toml
27-
else
28-
sed -i "s/^version = .*/version = \"$version\"/g" Cargo.toml
29-
fi
25+
./script/version.sh "$version"
3026

3127
echo "Create man page"
3228
./script/manpage.sh "$version" "$(date '+%Y-%m-%d')"
3329

30+
x86_64_unknown_linux_gnu_file="git-coauthor-x86_64-unknown-linux-gnu.tar.gz"
3431
x86_64_apple_darwin_file="git-coauthor-$version-x86_64-apple-darwin.tar.gz"
3532
aarch64_apple_darwin_file="git-coauthor-$version-aarch64-apple-darwin.tar.gz"
3633

34+
echo "Create $x86_64_unknown_linux_gnu_file"
35+
rm -rf bin
36+
mkdir -p bin
37+
mv git-coauthor-x86_64-unknown-linux-gnu bin/git-coauthor
38+
rm -f "$x86_64_unknown_linux_gnu_file"
39+
tar -czf "$x86_64_unknown_linux_gnu_file" ./man/ ./bin/
40+
3741
echo "Create $x86_64_apple_darwin_file"
3842
rm -rf bin
3943
mkdir -p bin
@@ -87,7 +91,12 @@ git push origin master
8791
git push origin "v$version"
8892

8993
echo "Create release"
90-
gh release create "v$version" "$x86_64_apple_darwin_file" "$aarch64_apple_darwin_file" -R nicholasdower/git-coauthor --notes-file tmp/.release-notes
94+
gh release create "v$version" \
95+
"$x86_64_unknown_linux_gnu_file" \
96+
"$x86_64_apple_darwin_file" \
97+
"$aarch64_apple_darwin_file" \
98+
-R nicholasdower/git-coauthor \
99+
--notes-file tmp/.release-notes
91100

92101
echo "Trigger Homebrew update"
93102
GH_TOKEN=$HOMEBREW_PAT gh workflow run update.yml --ref master -R nicholasdower/homebrew-tap

script/version.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
if [ $# -ne 1 ]; then
8+
echo "usage: $0 <version>" >&2
9+
exit 1
10+
fi
11+
12+
version="$1"
13+
14+
echo "Set version to $version"
15+
if [[ "$OSTYPE" == "darwin"* ]]; then
16+
sed -i "" "s/^version = .*/version = \"$version\"/g" Cargo.toml
17+
else
18+
sed -i "s/^version = .*/version = \"$version\"/g" Cargo.toml
19+
fi

0 commit comments

Comments
 (0)