2020-07-17 09:05:25 +08:00
|
|
|
name: Go
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
|
|
|
2022-06-30 16:49:10 +08:00
|
|
|
test-build:
|
|
|
|
name: Test and Build
|
2020-07-17 09:05:25 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Setup Go
|
2022-04-03 18:14:17 +08:00
|
|
|
uses: actions/setup-go@v3
|
2020-07-17 09:05:25 +08:00
|
|
|
with:
|
2022-05-24 15:20:10 +08:00
|
|
|
go-version: '^1.18'
|
2020-07-17 09:05:25 +08:00
|
|
|
- name: Check out code into the Go module directory
|
2022-03-02 12:43:41 +08:00
|
|
|
uses: actions/checkout@v3
|
2020-07-17 09:05:25 +08:00
|
|
|
- name: Cache go module
|
2022-03-26 09:54:29 +08:00
|
|
|
uses: actions/cache@v3
|
2020-07-17 09:05:25 +08:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2020-07-17 11:49:49 +08:00
|
|
|
- name: Get dependencies and run test
|
|
|
|
run: |
|
|
|
|
go test ./...
|
2020-07-17 09:05:25 +08:00
|
|
|
- name: Build
|
2022-06-29 22:15:58 +08:00
|
|
|
run: go build
|
2022-06-30 16:49:10 +08:00
|
|
|
|
|
|
|
release-aur-git:
|
|
|
|
name: Release Aur Git
|
|
|
|
needs: [test-build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-06-30 17:21:30 +08:00
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v3
|
2022-06-30 17:38:56 +08:00
|
|
|
|
|
|
|
- name: git config trust dir
|
|
|
|
run: git config --global --add safe.directory /github/workspace
|
|
|
|
|
2022-06-30 17:21:30 +08:00
|
|
|
- name: Publish AUR package nali-go-git
|
|
|
|
uses: zu1k/aur-publish-action@master
|
2022-06-30 16:49:10 +08:00
|
|
|
with:
|
|
|
|
package_name: nali-go-git
|
|
|
|
commit_username: 'zu1k'
|
|
|
|
commit_email: 'i@zu1k.com'
|
|
|
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|