Skip to content

ci: update

ci: update #3

Workflow file for this run

name: Build & Deploy
on:
push:
branches:
- master
jobs:
build:
name: Build Binary
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.16'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Get dependencies
run: |
go mod tidy
- name: Build
run: |
CGO_ENABLED=0 go build -v -ldflags "-w -s -extldflags '-static' -X 'github.com/NekoWheel/NekoCAS/internal/conf.CommitSHA=$GITHUB_SHA'" -o NekoCAS .
pwd
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: NekoCAS
path: /home/runner/work/NekoCAS/NekoCAS
dockerfile:
name: Build Image
runs-on: ubuntu-latest
needs: build
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
name: NekoCAS
path: /home/runner/work/NekoCAS/NekoCAS
- id: create_docker_tags
run: |
echo "::set-output name=tags::latest,$(git tag -l --sort=-v:refname | head -1 | cut -c 2-)"
- name: Build & Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ secrets.DOCKER_NAME }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}
tags: ${{ steps.create_docker_tags.outputs.tags }}