Skip to content

Commit c12f058

Browse files
committed
wip(release workflow): goreleaser(rust support) + release plz
1 parent 69e4aaa commit c12f058

File tree

2 files changed

+109
-54
lines changed

2 files changed

+109
-54
lines changed

.github/workflows/publish.yml

Lines changed: 78 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,66 +8,90 @@ permissions:
88
contents: read
99

1010
jobs:
11-
build:
12-
name: Build - ${{ matrix.target }}
13-
permissions:
14-
contents: write # Only needed for release artifact uploads
15-
runs-on: ${{ matrix.os }}
16-
timeout-minutes: 60
17-
strategy:
18-
matrix:
19-
include:
20-
# Arm
21-
- target: aarch64-unknown-linux-gnu
22-
os: ubuntu-22.04
23-
- target: aarch64-unknown-linux-musl
24-
os: ubuntu-22.04
25-
- target: aarch64-apple-darwin
26-
os: macos-13
27-
- target: aarch64-pc-windows-msvc
28-
os: windows-2022
29-
# x86
30-
- target: x86_64-unknown-linux-gnu
31-
os: ubuntu-22.04
32-
- target: x86_64-unknown-linux-musl
33-
os: ubuntu-22.04
34-
- target: x86_64-apple-darwin
35-
os: macos-13
36-
- target: x86_64-pc-windows-msvc
37-
os: windows-2022
38-
11+
goreleaser:
12+
runs-on: ubuntu-latest
3913
steps:
40-
- name: Checkout Git repo
14+
- name: Checkout
4115
uses: actions/checkout@v4
4216
with:
43-
persist-credentials: false
17+
fetch-depth: 0
4418

45-
- name: Set Perl environment variables
46-
if: runner.os == 'Windows'
47-
run: |
48-
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
49-
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: stable
23+
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v6
26+
with:
27+
distribution: goreleaser
28+
version: "~> v2"
29+
args: release --clean
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5032

51-
- name: Install rust toolchain
52-
if: ${{ !contains(matrix.target, 'apple') }}
53-
uses: dtolnay/rust-toolchain@stable
5433

55-
- uses: taiki-e/setup-cross-toolchain-action@v1
56-
with:
57-
target: ${{ matrix.target }}
58-
if: startsWith(matrix.os, 'ubuntu') && !contains(matrix.target, '-musl')
5934

60-
- uses: taiki-e/install-action@cross
61-
if: contains(matrix.target, '-musl')
35+
# build:
36+
# name: Build - ${{ matrix.target }}
37+
# permissions:
38+
# contents: write # Only needed for release artifact uploads
39+
# runs-on: ${{ matrix.os }}
40+
# timeout-minutes: 60
41+
# strategy:
42+
# matrix:
43+
# include:
44+
# # Arm
45+
# - target: aarch64-unknown-linux-gnu
46+
# os: ubuntu-22.04
47+
# - target: aarch64-unknown-linux-musl
48+
# os: ubuntu-22.04
49+
# - target: aarch64-apple-darwin
50+
# os: macos-13
51+
# - target: aarch64-pc-windows-msvc
52+
# os: windows-2022
53+
# # x86
54+
# - target: x86_64-unknown-linux-gnu
55+
# os: ubuntu-22.04
56+
# - target: x86_64-unknown-linux-musl
57+
# os: ubuntu-22.04
58+
# - target: x86_64-apple-darwin
59+
# os: macos-13
60+
# - target: x86_64-pc-windows-msvc
61+
# os: windows-2022
6262

63-
- run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
64-
if: endsWith(matrix.target, 'windows-msvc')
63+
# steps:
64+
# - name: Checkout Git repo
65+
# uses: actions/checkout@v4
66+
# with:
67+
# persist-credentials: false
6568

66-
- uses: taiki-e/upload-rust-binary-action@v1
67-
with:
68-
bin: "uv-migrator"
69-
target: ${{ matrix.target }}
70-
tar: all
71-
zip: windows
72-
token: ${{ secrets.GITHUB_TOKEN }}
73-
dry-run: false
69+
# - name: Set Perl environment variables
70+
# if: runner.os == 'Windows'
71+
# run: |
72+
# echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
73+
# echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
74+
75+
# - name: Install rust toolchain
76+
# if: ${{ !contains(matrix.target, 'apple') }}
77+
# uses: dtolnay/rust-toolchain@stable
78+
79+
# - uses: taiki-e/setup-cross-toolchain-action@v1
80+
# with:
81+
# target: ${{ matrix.target }}
82+
# if: startsWith(matrix.os, 'ubuntu') && !contains(matrix.target, '-musl')
83+
84+
# - uses: taiki-e/install-action@cross
85+
# if: contains(matrix.target, '-musl')
86+
87+
# - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
88+
# if: endsWith(matrix.target, 'windows-msvc')
89+
90+
# - uses: taiki-e/upload-rust-binary-action@v1
91+
# with:
92+
# bin: "uv-migrator"
93+
# target: ${{ matrix.target }}
94+
# tar: all
95+
# zip: windows
96+
# token: ${{ secrets.GITHUB_TOKEN }}
97+
# dry-run: false

.goreleaser.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- rustup default stable
6+
- cargo install --locked cargo-zigbuild
7+
- cargo fetch --locked
8+
9+
builds:
10+
- builder: rust
11+
flags:
12+
- --release
13+
targets:
14+
# linux
15+
- x86_64-unknown-linux-gnu
16+
- aarch64-unknown-linux-gnu
17+
# macos
18+
- x86_64-apple-darwin
19+
- aarch64-apple-darwin
20+
21+
archives:
22+
- format: tar.gz
23+
name_template: >-
24+
{{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }}
25+
26+
changelog:
27+
sort: asc
28+
filters:
29+
exclude:
30+
- "^docs:"
31+
- "^test:"

0 commit comments

Comments
 (0)