forked from langston-barrett/souffle-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (107 loc) · 3.6 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
name: release
on:
push:
branches:
- release*
tags:
- 'v*'
env:
# The NAME makes it easier to copy/paste snippets from other CI configs
NAME: souffle-lint
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deps
run: |
sudo apt-get install -y musl-tools
rustup target add x86_64-unknown-linux-musl
cargo install cargo-deb
- name: Build static executable
run: |
make CARGO_FLAGS=--locked static
cp target/x86_64-unknown-linux-musl/release/souffle-lint .
- name: Build Debian package
run: |
make deb
cp target/debian/souffle-lint_*_amd64.deb .
- uses: ncipollo/release-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
artifacts: "souffle-lint,souffle-lint_*_amd64.deb"
artifactErrorsFailBuild: true
body: "See [CHANGELOG.md](https://github.com/langston-barrett/souffle-lint/blob/main/CHANGELOG.md)"
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to crates.io
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
# Only push on actual release tags
PUSH: ${{ startsWith(github.ref, 'refs/tags/v') }}
# TODO(#29): Enable features
run: |
if [[ ${PUSH} == true ]]; then
cargo publish --locked --token ${CRATES_IO_TOKEN} --no-default-features
else
cargo publish --locked --dry-run --token ${CRATES_IO_TOKEN} --no-default-features
fi
# Inspired by rustfmt:
# https://github.com/rust-lang/rustfmt/blob/master/.github/workflows/upload-assets.yml
artifacts:
needs: release
strategy:
matrix:
build: [linux-x86_64-gnu, linux-x86_64-musl, macos-x86_64]
include:
- build: linux-x86_64-gnu
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux-x86_64-musl
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
# TODO(lb): Can these also be made stable?
- build: macos-x86_64
os: macos-latest
rust: nightly
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install rustup
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.target }}
- name: Add mingw64 to path for x86_64-gnu
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
if: matrix.rust == 'nightly-x86_64-gnu'
shell: bash
- name: Deps
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get install -y musl-tools
- name: Build executables
shell: bash
# TODO(#29): Enable features
run: |
cargo build \
--locked \
--release \
--no-default-features \
--target=${{ matrix.target }}
cp target/${{ matrix.target }}/release/${{ env.NAME }} ${{ env.NAME }}_${{ matrix.target }}
- name: Upload binaries
uses: ncipollo/release-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
allowUpdates: true
artifactErrorsFailBuild: true
replacesArtifacts: false
artifacts: ${{ env.NAME }}_${{ matrix.target }}
body: "See [CHANGELOG.md](https://github.com/langston-barrett/${{ env.NAME }}/blob/main/CHANGELOG.md)."
draft: true
token: ${{ secrets.GITHUB_TOKEN }}