Skip to content

Commit

Permalink
chore: improve github action
Browse files Browse the repository at this point in the history
  • Loading branch information
qloog committed Apr 28, 2023
1 parent cc089a1 commit 7dbe32e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 37 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ on:
branches:
- master
- release/*
# 当只有pull_request被合并到master分支的时候
pull_request:
branches:
- master
# 星期一到星期五的每天2点构建任务
#schedule:
# - cron: 0 2 * * 1-5
pull_request:
branches:
- master

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.16

- name: Check out code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v3

- name: Lint Go Code
run: |
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

permissions:
# required for all workflows
security-events: write

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
# TODO: Enable for javascript later
language: [ 'go']

steps:
- name: Checkout repo
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
# 主要用于release
# see: https://www.qikqiak.com/post/use-github-actions-build-go-app/
# https://goreleaser.com/
name: Release
name: GoRelease
on:
push:
tags:
- v*

permissions:
contents: write

jobs:
release:
name: Release on GitHub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Unshallow
run: git fetch --prune --unshallow

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
uses: goreleaser/goreleaser-action@v4
with:
version: latest
env:
Expand Down

0 comments on commit 7dbe32e

Please sign in to comment.