-
Notifications
You must be signed in to change notification settings - Fork 9
98 lines (83 loc) · 3.03 KB
/
release.yml
File metadata and controls
98 lines (83 loc) · 3.03 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
name: Release Please
on:
push:
branches:
- main
permissions:
contents: read
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_tag: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
id: release
- name: Checkout
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1
with:
persist-credentials: false
- name: Setup Ninja
if: ${{ steps.release.outputs.release_created }}
run: sudo apt-get install ninja-build
- name: Build singleheader
if: ${{ steps.release.outputs.release_created }}
run: |
cmake -DMERVE_TESTING=OFF -G Ninja -B build
cmake --build build --target merve-singleheader-lib
- name: Create singleheader.zip
if: ${{ steps.release.outputs.release_created }}
run: |
cd build/singleheader
zip singleheader.zip merve.h merve.cpp merve_c.h
mv singleheader.zip ../../singleheader/
cp merve.h merve.cpp merve_c.h ../../singleheader/
- name: Upload release assets
if: ${{ steps.release.outputs.release_created }}
run: gh release upload "$RELEASE_TAG" singleheader/singleheader.zip singleheader/merve.h singleheader/merve.cpp singleheader/merve_c.h
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.release.outputs.tag_name }}
- name: Publish release
if: ${{ steps.release.outputs.release_created }}
run: gh release edit "$RELEASE_TAG" --draft=false
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.release.outputs.tag_name }}
publish-rust:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Build and test (populates rust/deps from source)
working-directory: rust
run: cargo test
- name: Commit rust/deps and Cargo.lock if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add rust/deps/ rust/Cargo.lock
if git diff --cached --quiet; then
echo "rust/deps and Cargo.lock are up to date"
else
git commit -m "chore: update rust/deps vendored sources [skip ci]"
git push
fi
- name: Publish to crates.io
working-directory: rust
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}