1
0
mirror of https://github.com/zu1k/nali.git synced 2025-02-02 10:22:41 +08:00
nali/.github/workflows/go.yml
Zhiyong(Johnny) Zhao f2bec94681 fix: fix self-update bugs
1. added -v for update command, only update binary when -v is assigned;
2. removed the reference to semver library, implemented repo version compare functions;
3. edited release-aur-git rule in go.yml, won't replace the hyphen to dot in release version;
2023-09-28 16:31:29 -04:00

51 lines
1.4 KiB
YAML

name: Go
on: [push, pull_request]
jobs:
test-build:
name: Test and Build
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '^1.21'
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Cache go module
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies and run test
run: |
go test ./...
- name: Build
run: go build
release-aur-git:
name: Release Aur Git
needs: [test-build]
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get version
id: version
run: echo ::set-output name=version::$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;')
- name: Publish AUR package nali-go-git
uses: zu1k/aur-publish-action@master
with:
package_name: nali-go-git
commit_username: 'zu1k'
commit_email: 'i@zu1k.com'
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
new_release: ${{ steps.version.outputs.version }}