Skip to content

Commit 125aef7

Browse files
committed
init
0 parents  commit 125aef7

File tree

15 files changed

+2212
-0
lines changed

15 files changed

+2212
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

.github/workflows/cd.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release CD
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
7+
8+
jobs:
9+
10+
build-release:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
# Linux
17+
- os: ubuntu-latest
18+
target: x86_64-unknown-linux-musl
19+
- os: ubuntu-latest
20+
target: aarch64-unknown-linux-musl
21+
- os: ubuntu-latest
22+
target: arm-unknown-linux-musleabihf
23+
24+
# Darwin
25+
- os: macos-latest
26+
target: x86_64-apple-darwin
27+
- os: macos-latest
28+
target: aarch64-apple-darwin
29+
30+
# Windows
31+
- os: windows-latest
32+
target: x86_64-pc-windows-msvc
33+
ext: .exe
34+
35+
steps:
36+
- name: Checkout repo
37+
uses: actions/checkout@v2
38+
39+
- name: Setup Rust toolchain
40+
uses: actions-rs/toolchain@v1
41+
with:
42+
profile: minimal
43+
override: true
44+
target: ${{ matrix.target }}
45+
toolchain: stable
46+
47+
- name: Build
48+
uses: actions-rs/cargo@v1
49+
with:
50+
use-cross: true
51+
command: build
52+
args: --release --target ${{ matrix.target }}
53+
54+
- name: Rename Artifacts
55+
shell: bash
56+
run: |
57+
ver=${GITHUB_REF#refs/tags/}
58+
ASSET_PATH=servus-$ver-${{ matrix.target }}${{ matrix.ext }}
59+
mv target/${{ matrix.target }}/release/servus $ASSET_PATH
60+
echo "ASSET_PATH=$ASSET_PATH" >> $GITHUB_ENV
61+
- name: Release
62+
uses: softprops/action-gh-release@v1
63+
if: startsWith(github.ref, 'refs/tags/')
64+
with:
65+
files: ${{ env.ASSET_PATH }}
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker CD
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
tags:
8+
- "*"
9+
paths:
10+
- "servus/**"
11+
- ".github/workflows/docker.yml"
12+
- "Dockerfile"
13+
workflow_dispatch:
14+
15+
env:
16+
REGISTRY: ghcr.io
17+
# github.repository as <account>/<repo>
18+
IMAGE_NAME: ${{ github.repository }}
19+
20+
jobs:
21+
docker:
22+
name: Build Docker Image
23+
runs-on: ubuntu-latest
24+
steps:
25+
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
29+
- name: Log in to ghcr
30+
uses: docker/login-action@v1
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# Extract metadata (tags, labels) for Docker
37+
# https://github.com/docker/metadata-action
38+
- name: Extract Docker metadata
39+
id: meta
40+
uses: docker/metadata-action@v3.6.0
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
tags: |
44+
type=sha,format=long,enable=${{ github.ref_type != 'tag' }}
45+
type=ref,event=branch
46+
type=semver,pattern={{raw}},enable=${{ github.ref_type == 'tag' }}
47+
type=raw,value=latest,enable=${{ github.event.ref =='refs/heads/main'}}
48+
flavor: latest=false
49+
50+
- name: Build & Push
51+
uses: docker/build-push-action@v2
52+
with:
53+
context: .
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
/testdata
3+
/.vscode

0 commit comments

Comments
 (0)