Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ocfox committed Mar 21, 2023
0 parents commit d1f1991
Show file tree
Hide file tree
Showing 12 changed files with 125,224 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
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

- 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 \
wget pkg-config build-essential zlib1g-dev \
clang llvm libelf1 libelf-dev
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Cache rust
uses: Swatinem/rust-cache@v2

- name: build package
run: make build

- name: Publish
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'eunomia-bpf'
uses: softprops/action-gh-release@v1
with:
files: |
target/release/runqslower
prerelease: false
tag_name: ${{ steps.set_version.outputs.result }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
Loading

0 comments on commit d1f1991

Please sign in to comment.