blob: f63fdf0b8679d1f035dab97eb6ffbf577fdc858a (
plain)
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
|
name: release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
sctd_version: ${{ env.SCTD_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Get the release version from the tag
shell: bash
run: echo "SCTD_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $SCTD_VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$SCTD_VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ env.SCTD_VERSION }} --draft --verify-tag --title ${{ env.SCTD_VERSION }}
build-release:
name: build-release
needs: ['create-release']
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos]
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install packages (Linux)
if: matrix.build == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libx11-dev \
libxrandr-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Build release binary
run: cargo build --verbose --release --target ${{ matrix.target }}
- name: Strip release binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
run: strip "target/${{ matrix.target }}/release/sctd"
- name: Build archive
shell: bash
run: |
staging="sctd-${{ needs.create-release.outputs.sctd_version }}-${{ matrix.target }}"
mkdir -p "$staging"
cp "target/${{ matrix.target }}/release/sctd" "$staging/"
cp README.md LICENSE "$staging/"
tar czf "$staging.tar.gz" "$staging"
shasum -a 256 "$staging.tar.gz" > "$staging.tar.gz.sha256"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
echo "ASSET_SUM=$staging.tar.gz.sha256" >> $GITHUB_ENV
- name: Upload release archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.create-release.outputs.sctd_version }} ${{ env.ASSET }} ${{ env.ASSET_SUM }}
|