fix: linter #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- "v*" | |
paths: | |
- "**.go" | |
- "**.mod" | |
- "**.sum" | |
- "!.github/workflows/build.yml" | |
pull_request: | |
jobs: | |
build: | |
# strategy: | |
# matrix: | |
# go-version: [1.19] | |
# os: [macos-latest, ubuntu-latest, windows-latest] | |
# runs-on: ${{ matrix.os }} | |
runs-on: ubuntu-latest | |
permissions: write-all | |
env: | |
CGO_ENABLED: "0" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
# go-version: ${{ matrix.go-version }} | |
- name: Caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ubuntu-golang-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
ubuntu-golang- | |
# key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} | |
# restore-keys: | | |
# ${{ runner.os }}-golang- | |
- name: Recheck Compiler | |
if: contains(github.event_name, 'pull_request') | |
run: | | |
mkdir -p ./bin | |
go build -o ./bin/hoyolab . | |
- name: Releaser | |
if: success() && !contains(github.ref, 'main') && !contains(github.event_name, 'pull_request') | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Build | |
# if: success() | |
# run: | | |
# mkdir -p ./bin | |
# go build -o ./bin/hoyolab . | |
# cp README.md ./bin/README.md | |
# - name: Upload Artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: hoyolab-${{ matrix.os }}.tar | |
# path: bin | |
# retention-days: 3 | |
# - name: Zip | |
# if: success() | |
# uses: vimtor/action-zip@v1 | |
# with: | |
# files: hoyolab-* README.md | |
# dest: ./hoyolab-${{ github.ref_name }}-${{ matrix.os }}.zip | |
# - name: Create Release | |
# if: success() && !contains(github.ref, 'main') && !contains(github.event_name, 'pull_request') | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ github.ref }} | |
# release_name: Hoyolab ${{ github.ref_name }} | |
# draft: true | |
# - name: Upload Release | |
# if: success() && !contains(github.ref, 'main') && !contains(github.event_name, 'pull_request') | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, | |
# asset_path: ./hoyolab.zip | |
# asset_name: hoyolab-${{ github.ref_name }}-${{ matrix.name }}.zip | |
# asset_content_type: application/zip |