Skip to content

Commit

Permalink
chore: refactor GitHub Actions workflows
Browse files Browse the repository at this point in the history
- Fix a typo in the cron expression for the codeql.yml workflow
- Change the language specification from ['go'] to ['go'] in the codeql.yml workflow
- Change the version specification from 'v*' to 'v*' in the docker.yml workflow
- Change the branch specification from 'master' to 'master' in the docker.yml workflow
- Change the go-version specification from '^1' to '^1.21' in the docker.yml workflow
- Remove the name "Set up QEMU" in the docker.yml workflow
- Remove the name "Set up Docker Buildx" in the docker.yml workflow
- Remove the name "Login to Docker Hub" in the docker.yml workflow
- Remove the name "Login to GitHub Container Registry" in the docker.yml workflow
- Remove the name "Docker meta" in the docker.yml workflow
- Remove the name "Build and push" in the docker.yml workflow
- Change the version specification from '*' to '*' in the goreleaser.yml workflow
- Remove the name "Checkout" in the goreleaser.yml workflow
- Remove the name "Setup go" in the goreleaser.yml workflow
- Change the go-version specification from '^1' to '^1' in the goreleaser.yml workflow
- Remove the name "Run GoReleaser" in the goreleaser.yml workflow
- Change the go-version specification from '^1' to '^1' in the lint.yml workflow

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Oct 25, 2023
1 parent 32510c8 commit ddf1b16
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 42 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '41 23 * * 6'
- cron: "41 23 * * 6"

jobs:
analyze:
Expand All @@ -32,23 +32,23 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
language: ["go"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
27 changes: 11 additions & 16 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- master
tags:
- 'v*'
- "v*"
pull_request:
branches:
- 'master'
- "master"

jobs:
build-docker:
Expand All @@ -17,42 +17,38 @@ jobs:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '^1'
go-version: "^1.21"
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build binary
run : |
run: |
make build_linux_amd64
make build_linux_arm
make build_linux_arm64
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

-
name: Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Docker meta
- name: Docker meta
id: docker-meta
uses: docker/metadata-action@v4
with:
Expand All @@ -65,8 +61,7 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
-
name: Build and push
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Goreleaser
on:
push:
tags:
- '*'
- "*"

permissions:
contents: write
Expand All @@ -12,19 +12,16 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Setup go
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '^1'
go-version: "^1"

-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '^1'
go-version: "^1"
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup golangci-lint
Expand Down

0 comments on commit ddf1b16

Please sign in to comment.