From 38ed076ec09fd4f23ab96db5f203759bd2af09c4 Mon Sep 17 00:00:00 2001 From: Steffen Hildebrandt Date: Thu, 23 May 2024 14:47:52 +0200 Subject: [PATCH] added workflow for GH and GHCR releases --- .github/workflows/release.yaml | 41 ++++++++++++++++++++++++++++++++++ .gitignore | 2 +- Dockerfile | 8 +++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..2ab6b66 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,41 @@ +name: Create Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: 1.22.1 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build + run: | + env GOOS=darwin GOARCH=arm64 go build -ldflags "-w -s" -o logicng-service-macos-arm main.go + env GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-macos-amd main.go + env GOOS=linux GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-linux main.go + env GOOS=windows GOARCH=amd64 go build -ldflags "-w -s" -o logicng-service-win.exe main.go + - name: Build and Push Docker Image + run: | + docker build . -t ghcr.io/booleworks/logicng-service:${{ github.ref }} + docker push ghcr.io/booleworks/logicng-service:${{ github.ref }} + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: | + logicng-service-macos-arm + logicng-service-macos-amd + logicng-service-linux + logicng-service-win.exe diff --git a/.gitignore b/.gitignore index f97daee..a5bb878 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ *.swp # build -logicng-service +logicng-service* # docs docs/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..54afe62 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:latest + +ENV TIMEOUT 5s + +COPY logicng-service-linux /opt/logicng-service + +EXPOSE 8080 +CMD /opt/logicng-service --timeout $TIMEOUT