generated from eunomia-bpf/libbpf-starter-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 2.12 KB
/
publish.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
name: Build and publish
on:
push:
branches: "master"
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
target: [ x86_64-unknown-linux-gnu ]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set latest release version
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: set_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
const { data: tags } = await github.rest.repos.listTags({
owner: context.repo.owner,
repo: context.repo.repo
});
if (releases.length === 0) { return "v0.0.1"; }
function increase_v(version) {
const parts = version.split(".");
const last = parseInt(parts[2]) + 1;
const next_version = `${parts[0]}.${parts[1]}.${last.toString()}`;
return next_version;
}
const latest_release_tag = releases[0].tag_name;
const tag = tags.find(tag => tag.commit.sha === context.sha);
return tag ? tag.name : increase_v(latest_release_tag)
- name: install deps
run: |
sudo apt-get install -y --no-install-recommends \
libelf1 libelf-dev zlib1g-dev libclang-13-dev \
make git clang llvm pkg-config build-essential
- name: build package
run: make build
- name: Publish
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
with:
files: |
src/bootstrap
prerelease: false
tag_name: ${{ steps.set_version.outputs.result }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}