-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Go CI + Docker CD | ||
|
||
on: | ||
push: | ||
branches: [ master, main ] | ||
paths-ignore: | ||
- '**.md' | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Libraries | ||
run: sudo apt-get install -y libpcap-dev libluajit-5.1-dev | ||
|
||
- name: LuaJIT | ||
run: git clone https://luajit.org/git/luajit-2.0.git && cd luajit-2.0 && make CCOPT="-static -fPIC" BUILDMODE="static" && sudo make install | ||
|
||
- name: Build | ||
run: make all | ||
|
||
- name: Retrieve version | ||
run: | | ||
echo "HEPLIFY_VERSION=$(cat config/config.go | sed -n 's/^.*heplify-server \([0-9.]*\).*/\1/p')" >> $GITHUB_OUTPUT | ||
echo "${{ env.HEPLIFY_VERSION }}" | ||
id: version | ||
|
||
|
||
docker-push: | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
needs: build | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Docker QEMU | ||
uses: docker/[email protected] | ||
with: | ||
platforms: amd64, arm64 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push to GHCR | ||
uses: docker/[email protected] | ||
with: | ||
platforms: linux/amd64, linux/arm64 | ||
file: ./docker/Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/sipcapture/heplify-server:latest | ||
ghcr.io/sipcapture/heplify-server:${{ env.HEPLIFY_VERSION }} | ||
labels: | | ||
dev.heplify-server.image.title=heplify-server | ||
dev.heplify-server.image.version=${{ env.HEPLIFY_VERSION }} |