feat(ci): auto upload to ghcr and release artifact
This commit is contained in:
@@ -5,6 +5,8 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -55,3 +57,36 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: tslink-dev${{ steps.date.outputs.date }}-${{ matrix.goos }}_${{ matrix.goarch }}
|
name: tslink-dev${{ steps.date.outputs.date }}-${{ matrix.goos }}_${{ matrix.goarch }}
|
||||||
path: release/
|
path: release/
|
||||||
|
|
||||||
|
container:
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: '1.26.3'
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Install ko
|
||||||
|
run: go install github.com/google/ko@latest
|
||||||
|
|
||||||
|
- name: Build and push container image
|
||||||
|
env:
|
||||||
|
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/tslink
|
||||||
|
run: |
|
||||||
|
ko build --bare ./ --platform=all \
|
||||||
|
-t latest \
|
||||||
|
-t ${{ github.ref_name }}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
builds:
|
||||||
|
- id: tslink
|
||||||
|
main: .
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
ldflags:
|
||||||
|
- -s
|
||||||
|
- -w
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
tslink:
|
||||||
|
image: ghcr.io/saltedfishclub/tslink:latest
|
||||||
|
ports:
|
||||||
|
- "9000:9000"
|
||||||
|
- "25565:25565"
|
||||||
|
volumes:
|
||||||
|
- ./config.toml:/etc/tslink/config.toml:ro
|
||||||
|
- tslink_state:/var/lib/tslink
|
||||||
|
command: ["-c", "/etc/tslink/config.toml"]
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
tslink_state:
|
||||||
Reference in New Issue
Block a user