fix linting #53
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: CI | |
on: | |
workflow_dispatch: {} | |
pull_request: {} | |
release: | |
types: [published] | |
push: | |
branches: | |
- master | |
- develop | |
- release/* | |
- feature/* | |
- hotfix/* | |
jobs: | |
test: | |
runs-on: default | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.23 | |
- name: Test | |
run: go test -v ./... | |
lint: | |
name: lint | |
runs-on: default | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
only-new-issues: true | |
build: | |
name: Build 🏗 | |
runs-on: default | |
needs: [lint, test] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Generate Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ inputs.image_name }} | |
tags: | | |
# Raw sha of the commit | |
type=raw,value={{sha}} | |
# Branch name with and without the sha suffix | |
type=raw,value={{branch}},enable=${{ github.event_name == 'push' }} | |
type=raw,value={{branch}}-{{sha}},enable=${{ github.event_name == 'push' }} | |
# Branch name with and without the sha suffix and unix timestamp milliseconds | |
type=raw,value={{branch}}-{{date 'x'}},enable=${{ github.event_name == 'push' }} | |
type=raw,value={{branch}}-{{sha}}-{{date 'x'}},enable=${{ github.event_name == 'push' }} | |
# PR number with and without the sha suffix | |
type=raw,value=${{github.head_ref}},enable=${{ github.event_name == 'pull_request' }} | |
type=raw,value=${{github.head_ref}}-{{sha}},enable=${{ github.event_name == 'pull_request' }} | |
# Release tag | |
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} | |
type=raw,value={{tag}},enable=${{ github.event_name == 'release' }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.wiseflow.io | |
username: ${{ secrets.HARBOR_USERNAME }} | |
password: ${{ secrets.HARBOR_TOKEN }} | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
provenance: false | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=build | |
cache-to: type=gha,mode=max,scope=build | |
platforms: ${{ inputs.platforms }} | |
- name: Write summary | |
run: | | |
echo "# Image tags" >> $GITHUB_STEP_SUMMARY | |
for tag in ${{ join(fromJSON(steps.meta.outputs.json).tags, ' ') }} | |
do | |
echo "- $tag" >> $GITHUB_STEP_SUMMARY | |
done |