-
Notifications
You must be signed in to change notification settings - Fork 6
177 lines (168 loc) · 6.04 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Release
on:
pull_request:
paths:
- .github/workflows/*.yml
- Cargo.toml
- crates/**
- src/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: "-Dwarnings"
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: 1
VERSION: "v1.0.0" # FIXME
permissions:
contents: write
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get release version
run: |
echo "VERSION=1.0.0" >> $GITHUB_ENV
- name: Show release version
run: |
echo "version is $VERSION"
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$VERSION" --draft --title "v$VERSION"
outputs:
version: ${{ env.VERSION }}
# release:
# needs: prepare
# strategy:
# matrix:
# target:
# - { os: ubuntu-latest, toolchain: stable, triple: x86_64-unknown-linux-gnu }
# - { os: windows-latest, toolchain: stable, triple: i686-pc-windows-msvc }
# - { os: macos-latest, toolchain: stable, triple: x86_64-apple-darwin }
# runs-on: ${{ matrix.target.os }}
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ matrix.target.toolchain }}
# targets: ${{ matrix.target.triple }}
# - name: Test workspace packages
# run: |
# cargo test -p pica-record --release --all-features
# cargo test -p pica-cli --release --all-features
# - name: Build release binary
# shell: bash
# run: |
# cargo build -p pica-cli --release --features performant
# if [ "${{ matrix.target.os }}" = "windows-latest" ]; then
# echo "BINARY=target/release/pica.exe" >> $GITHUB_ENV
# else
# echo "BINARY=target/release/pica" >> $GITHUB_ENV
# fi
# - name: Strip release binary
# shell: bash
# if: matrix.target.os == 'macos-latest'
# run:
# strip "$BINARY"
# - name: Prepare archive
# shell: bash
# run: |
# version="${{ needs.prepare.outputs.version }}"
# triple="${{ matrix.target.triple }}"
# ARCHIVE="pica-$version-$triple"
# echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
# mkdir -p "$ARCHIVE/complete"
# cp "$BINARY" "$ARCHIVE"/
# cp "README.md" "$ARCHIVE"/
# cp "LICENSE" "$ARCHIVE"/
# - name: Generate completions
# shell: bash
# run: |
# $BINARY completions bash -o "$ARCHIVE/complete/pica.bash"
# $BINARY completions elvish -o "$ARCHIVE/complete/pica.elv"
# $BINARY completions fish -o "$ARCHIVE/complete/pica.fish"
# $BINARY completions powershell -o "$ARCHIVE/complete/_pica.ps1"
# $BINARY completions zsh -o "$ARCHIVE/complete/_pica"
# - name: Build Archive (Windows)
# if: matrix.target.os == 'windows-latest'
# shell: bash
# run: |
# 7z a "$ARCHIVE.zip" "$ARCHIVE"
# certutil -hashfile "$ARCHIVE.zip" SHA256 > "$ARCHIVE.zip.sha256"
# echo "ASSET_CHECKSUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV
# echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV
# - name: Build Archive (Unix)
# if: matrix.target.os != 'windows-latest'
# shell: bash
# run: |
# tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
# shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
# echo "ASSET_CHECKSUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV
# echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV
# - name: Upload assets
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# shell: bash
# run: |
# version="${{ needs.prepare.outputs.version }}"
# gh release upload "$version" ${{ env.ASSET_CHECKSUM }}
# gh release upload "$version" ${{ env.ASSET }}
packaging:
needs: prepare
strategy:
matrix:
target:
- { image: "debian:latest", toolchain: stable, triple: x86_64-unknown-linux-gnu }
runs-on: ubuntu-latest
container:
image: ${{ matrix.target.image}}
steps:
- name: Install Packages (Debian)
if: ${{ startsWith(matrix.target.image, 'debian') }}
run: |
apt-get update && apt-get install curl build-essential -y
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.target.toolchain }}
targets: ${{ matrix.target.triple }}
# - name: Test workspace packages
# run: |
# cargo test -p pica-record --release --all-features
# cargo test -p pica-cli --release --all-features
- name: Build release binary
shell: bash
run: |
cargo build -p pica-cli --release --features performant
echo "BINARY=target/release/pica" >> $GITHUB_ENV
- name: Generate completions
shell: bash
run: |
mkdir -p "assets/"
$BINARY completions bash -o "assets/pica.bash"
$BINARY completions fish -o "assets/pica.fish"
$BINARY completions zsh -o "assets/pica.zsh"
echo "ASSETS=assets" >> $GITHUB_ENV
- name: Install `cargo-deb`
run: |
cargo install cargo-deb
- name: Build Debian package
run: |
# version=${{ needs.prepare.VERSION }}
cargo deb -v -p pica-cli
echo "ASSET=target/debian/pica-0.25.0-1_amd64.deb" >> $GITHUB_ENV
echo "ASSET_CHECKSUM=$ASSET.sha256" >> $GITHUB_ENV
shasum -a 256 "$ASSET" > "$ASSET_CHECKSUM"
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
version="${{ needs.prepare.outputs.version }}"
gh release upload "$version" ${{ env.ASSET_CHECKSUM }}
gh release upload "$version" ${{ env.ASSET }}