This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add release and docker workflows (#3)
- Loading branch information
Showing
11 changed files
with
305 additions
and
22 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,51 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
flavor: | | ||
latest=${{ github.event_name == 'release' && github.event.release.prerelease == false }} | ||
tags: | | ||
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} | ||
type=raw,value=nightly,enable=${{ github.event_name == 'release' && github.event.release.prerelease == true }} | ||
type=ref,enable=true,event=branch | ||
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }} | ||
type=raw,value=${{ github.event.release.name }},enable=${{ github.event_name == 'release' }} | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 |
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: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Build | ||
run: go build -v -o ./tmp/beeapi-linux-amd64 ./main.go | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: beeapi-linux-amd64 | ||
path: ./tmp/beeapi-linux-amd64 | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Build | ||
run: go build -v -o ./tmp/beeapi-windows-amd64.exe ./main.go | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: beeapi-windows-amd64.exe | ||
path: ./tmp/beeapi-windows-amd64.exe | ||
|
||
publish: | ||
needs: [build-linux, build-windows] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download Linux Build Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: beeapi-linux-amd64 | ||
path: ./builds | ||
|
||
- name: Download Windows Build Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: beeapi-windows-amd64.exe | ||
path: ./builds | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./build/beeapi-linux-amd64 | ||
./build/beeapi-windows-amd64.exe | ||
tag_name: ${{ github.ref_name }} | ||
name: ${{ github.ref_name }} | ||
body: | | ||
Automated release, please set a proper body before publishing. | ||
draft: true | ||
prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'prerelease') }} |
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,11 @@ | ||
FROM golang:1.20 AS build | ||
WORKDIR /build | ||
COPY go.mod go.sum /build/ | ||
RUN go mod download | ||
COPY . /build/ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /tmp/beeapi-linux-amd64 ./main.go | ||
|
||
FROM alpine:latest | ||
COPY --from=build /tmp/beeapi-linux-amd64 /app/beeapi | ||
WORKDIR /app | ||
CMD ["/app/beeapi"] |
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
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
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,8 @@ | ||
services: | ||
beeapi: | ||
image: ghcr.io/frc5183/beeapi:latest | ||
restart: always | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- ./config:/etc/beeapi |
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
Oops, something went wrong.