-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (115 loc) · 4.59 KB
/
release.yml
File metadata and controls
134 lines (115 loc) · 4.59 KB
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
name: Release
run-name: Release v${{ inputs.version }} with apply=${{ inputs.apply }}
on:
workflow_dispatch:
inputs:
version:
description: version. The next release version (without prefix v)
required: true
apply:
description: apply. Specify whether the actual release should be performed or not
type: boolean
permissions: {}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
suffix: .tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
suffix: .tar.gz
- target: x86_64-apple-darwin
os: macOS-latest
suffix: .tar.gz
- target: aarch64-apple-darwin
os: macOS-latest
suffix: .tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
suffix: .zip
- target: aarch64-pc-windows-msvc
os: windows-latest
suffix: .zip
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- run: sudo apt-get update --yes && sudo apt-get install --yes --no-install-recommends libx11-xcb-dev libxcb-shape0-dev libxcb-xfixes0-dev musl-tools
if: matrix.os == 'ubuntu-latest'
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Install cross
if: matrix.os == 'ubuntu-latest'
run: cargo install cross
- name: Build with Cargo
if: matrix.os != 'ubuntu-latest'
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Build with Cross
if: matrix.os == 'ubuntu-latest'
run: cross build --release --locked --target ${{ matrix.target }}
- name: Bundle on Windows
run: 7z a ../../../thwack-${{ matrix.target }}${{ matrix.suffix }} thwack.exe
if: matrix.os == 'windows-latest'
working-directory: target/${{ matrix.target }}/release
- name: Bundle on -nix
run: tar cf ../../../thwack-${{ matrix.target }}${{ matrix.suffix }} thwack
if: matrix.os != 'windows-latest'
working-directory: target/${{ matrix.target }}/release
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
with:
name: Artifact-thwack-${{ matrix.target }}${{ matrix.suffix }}
path: thwack-${{ matrix.target }}${{ matrix.suffix }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- run: sudo apt-get update --yes && sudo apt-get install --yes --no-install-recommends libx11-xcb-dev libxcb-shape0-dev libxcb-xfixes0-dev
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
- uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
with:
toolchain: stable
- name: Bump the package version
run: |
sed -i -e "s/^version = .*$/version = \"${INPUTS_VERSION}\"/" Cargo.toml
cargo build
env:
INPUTS_VERSION: ${{ inputs.version }}
- uses: yykamei/actions-git-push@8ae8cff5a3dc70f40645250bd9e59e2979a2543c
with:
commit-message: Bump to ${{ inputs.version }}
if: inputs.apply
- name: Create a GitHub release and publish the crate on crates.io
run: ./scripts/release.sh
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VERSION: ${{ inputs.version }}
APPLY: ${{ inputs.apply }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: Calculate checksums
run: |
mv Artifact-thwack-*/thwack-* .
for f in thwack-*; do sha256sum "$f" | awk '{print $1}' > "${f}.sha256"; done
- name: Upload assets to the release
if: inputs.apply
run: gh release upload "v${INPUTS_VERSION}" thwack-*
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
INPUTS_VERSION: ${{ inputs.version }}