Skip to content

Commit 00baf46

Browse files
committed
ci: fix auto release
1 parent 91c20b6 commit 00baf46

File tree

3 files changed

+23
-99
lines changed

3 files changed

+23
-99
lines changed

.github/workflows/release.yml

+18-85
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ jobs:
2323
uses: actions/checkout@v4
2424
- name: Get the release version from the tag
2525
if: env.VERSION == ''
26-
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/v\(.*\)-.*/\1/')" >> $GITHUB_ENV
26+
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
2727
- name: Show the version
2828
run: |
2929
echo "version is: $VERSION"
3030
- name: Check that tag version and Cargo.toml version are the same
3131
shell: bash
3232
run: |
33-
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
33+
if ! grep -q "version = \"$(echo $VERSION | sed 's/v\(.*\)-.*/\1/')\"" Cargo.toml; then
3434
echo "version does not match Cargo.toml" >&2
3535
exit 1
3636
fi
3737
- name: Create GitHub release
3838
env:
3939
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
run: gh release create v$VERSION --verify-tag --draft --title $VERSION
40+
run: gh release create $VERSION --verify-tag --draft --title $VERSION
4141
outputs:
4242
version: ${{ env.VERSION }}
4343

@@ -133,12 +133,6 @@ jobs:
133133
- name: Checkout the repo
134134
uses: actions/checkout@v4
135135

136-
- name: Install packages (Ubuntu)
137-
if: matrix.os == 'ubuntu-latest'
138-
shell: bash
139-
run: |
140-
ci/ubuntu-install-packages
141-
142136
- name: Install Rust
143137
uses: dtolnay/rust-toolchain@master
144138
with:
@@ -208,10 +202,22 @@ jobs:
208202
- name: Creating directory for archive
209203
shell: bash
210204
run: |
211-
mkdir -p "$ARCHIVE"/{complete,doc}
205+
mkdir -p "$ARCHIVE"
212206
cp "$BIN" "$ARCHIVE"/
213-
cp {README.md,LICENSE,demo.gif} "$ARCHIVE"/
214-
cp {CHANGELOG.md} "$ARCHIVE"/doc/
207+
cp {README.md,LICENSE,demo.gif,CHANGELOG.md} "$ARCHIVE"/
208+
209+
- uses: actions/checkout@v4
210+
with:
211+
repository: pythonbrad/afrim-man
212+
fetch-depth: 1
213+
path: afrim-man
214+
215+
- name: Build and Add documentation
216+
shell: bash
217+
run: |
218+
${{ env.CARGO }} install mdbook
219+
mdbook build afrim-man
220+
cp -r afrim-man/book "$ARCHIVE"/
215221
216222
- name: Build archive (Windows)
217223
shell: bash
@@ -238,76 +244,3 @@ jobs:
238244
run: |
239245
version="${{ needs.create-release.outputs.version }}"
240246
gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }}
241-
242-
build-release-deb:
243-
name: build-release-deb
244-
needs: ["create-release"]
245-
runs-on: ubuntu-latest
246-
env:
247-
TARGET: x86_64-unknown-linux-musl
248-
# Emit backtraces on panics.
249-
RUST_BACKTRACE: 1
250-
251-
steps:
252-
- name: Checkout the repo
253-
uses: actions/checkout@v4
254-
255-
- name: Install packages (Ubuntu)
256-
shell: bash
257-
run: |
258-
ci/ubuntu-install-packages
259-
260-
- name: Install Rust
261-
uses: dtolnay/rust-toolchain@master
262-
with:
263-
toolchain: nightly
264-
target: ${{ env.TARGET }}
265-
266-
- name: Install cargo-deb
267-
shell: bash
268-
run: |
269-
cargo install cargo-deb
270-
271-
# 'cargo deb' does not seem to provide a way to specify an asset that is
272-
# created at build time, such as afrim-wish's man page. To work around this,
273-
# we force a debug build, copy out the man page (and shell completions)
274-
# produced from that build, put it into a predictable location and then
275-
# build the deb, which knows where to look.
276-
- name: Build debug binary to create release assets
277-
shell: bash
278-
run: |
279-
cargo build --target ${{ env.TARGET }}
280-
bin="target/${{ env.TARGET }}/debug/afrim-wish"
281-
echo "BIN=$bin" >> $GITHUB_ENV
282-
283-
- name: Create deployment directory
284-
shell: bash
285-
run: |
286-
dir=deployment/deb
287-
mkdir -p "$dir"
288-
echo "DEPLOY_DIR=$dir" >> $GITHUB_ENV
289-
290-
- name: Build release binary
291-
shell: bash
292-
run: |
293-
cargo deb --profile deb --target ${{ env.TARGET }}
294-
version="${{ needs.create-release.outputs.version }}"
295-
echo "DEB_DIR=target/${{ env.TARGET }}/debian" >> $GITHUB_ENV
296-
echo "DEB_NAME=afrim-wish-$version-1-amd64.deb" >> $GITHUB_ENV
297-
298-
- name: Create sha256 sum of deb file
299-
shell: bash
300-
run: |
301-
cd "$DEB_DIR"
302-
sum="$DEB_NAME.sha256"
303-
shasum -a 256 "$DEB_NAME" > "$sum"
304-
echo "SUM=$sum" >> $GITHUB_ENV
305-
306-
- name: Upload release archive
307-
env:
308-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
309-
shell: bash
310-
run: |
311-
cd "$DEB_DIR"
312-
version="${{ needs.create-release.outputs.version }}"
313-
gh release upload "$version" "$DEB_NAME" "$SUM"

Cross.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
pre-build = [
3+
# additional commands to run prior to building the package
4+
"apt-get update && apt-get install -y libxtst-dev libevdev-dev libxdo-dev xorg-dev",
5+
]

ci/ubuntu-install-packages

-14
This file was deleted.

0 commit comments

Comments
 (0)