feat(ci): auto upload to ghcr and release artifact
This commit is contained in:
@@ -5,6 +5,8 @@ on:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -55,3 +57,36 @@ jobs:
|
||||
with:
|
||||
name: tslink-dev${{ steps.date.outputs.date }}-${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
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 }}
|
||||
|
||||
Reference in New Issue
Block a user