2022-06-29 22:15:58 +08:00
|
|
|
name: Go Release
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
jobs:
|
|
|
|
release-binary:
|
|
|
|
name: Release Binary
|
|
|
|
runs-on: ubuntu-latest
|
2022-07-24 13:20:51 +08:00
|
|
|
environment: s3
|
2022-06-29 22:15:58 +08:00
|
|
|
steps:
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2022-08-15 09:30:18 +08:00
|
|
|
go-version: '^1.19'
|
2022-06-29 22:15:58 +08:00
|
|
|
|
|
|
|
- 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
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
env:
|
|
|
|
NAME: nali
|
|
|
|
BINDIR: bin
|
|
|
|
run: make -j releases && make sha256sum
|
|
|
|
|
|
|
|
- name: Upload Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
files: bin/*
|
|
|
|
draft: true
|
|
|
|
prerelease: true
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
name: build
|
|
|
|
path: bin
|
|
|
|
|
2022-07-24 13:20:51 +08:00
|
|
|
- name: Upload to s3
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
run: sh .github/scripts/upload_s3.sh
|
|
|
|
env:
|
|
|
|
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
|
|
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
|
|
|
|
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
|
|
|
|
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
|
|
|
|
|
2022-06-30 18:41:55 +08:00
|
|
|
release-aur-bin:
|
|
|
|
name: Release Aur bin
|
|
|
|
needs: [release-binary]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Get version
|
|
|
|
id: version
|
|
|
|
run: echo ::set-output name=version::${GITHUB_REF##*/v}
|
|
|
|
|
|
|
|
- name: Publish AUR package nali-go-bin
|
|
|
|
uses: zu1k/aur-publish-action@master
|
|
|
|
with:
|
|
|
|
package_name: nali-go-bin
|
|
|
|
commit_username: 'zu1k'
|
|
|
|
commit_email: 'i@zu1k.com'
|
|
|
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
|
|
new_release: ${{ steps.version.outputs.version }}
|
|
|
|
|
2022-06-29 22:15:58 +08:00
|
|
|
release-aur:
|
|
|
|
name: Release Aur
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-06-30 18:04:38 +08:00
|
|
|
- name: Get version
|
|
|
|
id: version
|
|
|
|
run: echo ::set-output name=version::${GITHUB_REF##*/v}
|
2022-06-30 17:38:56 +08:00
|
|
|
|
2022-06-30 17:21:30 +08:00
|
|
|
- name: Publish AUR package nali-go
|
|
|
|
uses: zu1k/aur-publish-action@master
|
2022-06-29 22:15:58 +08:00
|
|
|
with:
|
|
|
|
package_name: nali-go
|
|
|
|
commit_username: 'zu1k'
|
|
|
|
commit_email: 'i@zu1k.com'
|
|
|
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
2022-06-30 18:04:38 +08:00
|
|
|
new_release: ${{ steps.version.outputs.version }}
|