Skip to content

Commit 38ce880

Browse files
committed
Add CI
1 parent 65ef7dd commit 38ce880

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

.github/workflows/audit.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Security Audit
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
audit:
7+
name: Audit
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: rustsec/audit-check@v1.4.1
12+
with:
13+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docker.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
package:
8+
name: Build 22.04 Docker Image
9+
timeout-minutes: 60
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Login to GitHub Container Registry
16+
uses: docker/login-action@v3
17+
with:
18+
registry: ghcr.io
19+
username: ${{ github.actor }}
20+
password: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Build docker image
23+
run: docker build -t ghcr.io/jonlamb-gh/ctf-util:latest .
24+
25+
- name: Push docker image
26+
run: docker push ghcr.io/jonlamb-gh/ctf-util:latest

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
# Push events to matching v*, i.e. v1.0, v20.15.10
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
jobs:
10+
build:
11+
name: Build Release Artifacts
12+
runs-on: ubuntu-20.04
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Print version
17+
run: |
18+
RELEASE_TAG=${{ github.ref }}
19+
RELEASE_TAG="${RELEASE_TAG#refs/tags/}"
20+
RELEASE_VERSION="${RELEASE_TAG#v}"
21+
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
22+
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
23+
echo "Release tag: $RELEASE_TAG"
24+
echo "Release version: $RELEASE_VERSION"
25+
26+
- name: Checkout sources
27+
uses: actions/checkout@v4
28+
29+
- name: Install system dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install --no-install-recommends --assume-yes patchelf gzip cmake make gcc g++ build-essential
33+
sudo apt-get install --no-install-recommends --assume-yes libssl-dev libglib2.0-dev pkg-config libtool flex bison autoconf automake
34+
35+
- name: Install toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
toolchain: stable
39+
40+
- name: Fetch dependencies
41+
run: cargo fetch
42+
43+
- name: Build release binaries
44+
run: cargo build --release
45+
46+
- name: Setup upterm session
47+
uses: lhotari/action-upterm@v1
48+
if: ${{ failure() }}
49+
with:
50+
## If no one connects after 5 minutes, shut down server.
51+
wait-timeout-minutes: 5
52+
53+
- name: Create github release
54+
id: create_release
55+
uses: softprops/action-gh-release@v2
56+
with:
57+
draft: false
58+
prerelease: false
59+
name: Release ${{ env.RELEASE_VERSION }}
60+
files: |
61+
target/release/ctf-util

0 commit comments

Comments
 (0)