Skip to content

Commit

Permalink
Merge pull request #6 from krogon/update/20240624
Browse files Browse the repository at this point in the history
Update/20240624
  • Loading branch information
krogon authored Jun 24, 2024
2 parents 7d547fe + 082fec7 commit ae370d2
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 109 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@ on: [pull_request]
jobs:
lint:
name: Linters
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
with:
depth: 1
- uses: actions/checkout@v3

- run: make lint
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
go_version: '1.19'
golangci_lint_flags: '-c .golangci.yaml'
reporter: github-pr-review

tests:
name: Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
with:
depth: 1
- uses: actions/checkout@v4

- uses: actions/setup-go@v1
- uses: actions/setup-go@v4
with:
go-version: '1.13.1'
go-version: '1.19'
cache: true

- run: make test
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ name: Release

on:
pull_request:
types: closed
types: [closed]

jobs:
build:
name: Build and release
runs-on: ubuntu-latest

if: github.event.pull_request.merged

steps:
- name: Compute next SemVer tag
id: semver
Expand All @@ -16,10 +20,11 @@ jobs:
release_strategy: none
default_increment: minor
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.base_ref }}

- run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u krogon --password-stdin
Expand All @@ -33,12 +38,10 @@ jobs:
env:
VERSION: ${{ steps.semver.outputs.tag }}

- uses: stefanzweifel/git-auto-commit-action@v2.1.0
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Release ${{ steps.semver.outputs.tag }}
branch: ${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
branch: master

- name: Create release
id: tag
Expand All @@ -47,4 +50,4 @@ jobs:
release_branch: master
tag: ${{ steps.semver.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108 changes: 96 additions & 12 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,122 @@
linters:
disable-all: true
enable:
# default
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
# added

# addition
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
- depguard
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exhaustruct
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- interfacer
- maligned
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- grouper
- importas
- inamedparam
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- scopelint
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- gosec
- golint
- gochecknoglobals
- lll # hard to fulfill
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
- zerologlint

run:
modules-download-mode: vendor
modules-download-mode: readonly
go: '1.19'
tests: false

output:
show-stats: true
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build
FROM golang:1.13-alpine AS build
FROM golang:1.19-alpine AS build

RUN apk add --no-cache --update make \
&& rm -f /var/cache/apk/*
Expand All @@ -10,7 +10,7 @@ ADD ./ /go/src/app
RUN make build

# Run
FROM alpine:3.10
FROM alpine:3.20

COPY entrypoint.sh /entrypoint.sh
COPY --from=build /go/src/app/bumper /bumper
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ VERSION?=latest

.PHONY: lint
lint: vendor
docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:latest golangci-lint run -c .golangci.yaml --skip-dirs-use-default
docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:latest golangci-lint run -c .golangci.yaml

.PHONY: test
test: vendor
go test -mod=vendor ./...
go test ./...

vendor:
vendor: go.mod go.sum
go mod tidy
go mod vendor

.PHONY: build
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ name: Release

on:
pull_request:
types: closed
types: [closed]

jobs:
build:
runs-on: ubuntu-latest

if: github.event.pull_request.merged

steps:
- name: Tag
uses: krogon/semver-release-action@master
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ outputs:

runs:
using: 'docker'
image: 'docker://krogon/semver-release-action:latest'
image: 'docker://krogon/semver-release-action:v2.1.0'
args:
- ${{ inputs.release_branch }}
- ${{ inputs.release_strategy }}
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
if [ -z "${NEXT_TAG}" ]
then
echo ::debug ::Executing bumper latest-tag github_repository=${GITHUB_REPOSITORY}
LATEST_TAG=$(/bumper latest-tag "${GITHUB_REPOSITORY}" "${GITHUB_TOKEN}")
LATEST_TAG=$(/bumper latest-tag "${GITHUB_REPOSITORY}" "${GITHUB_TOKEN}" "${TAG_FORMAT}")

echo ::debug ::Executing bumper increment github_event_path=${GITHUB_EVENT_PATH}
INCREMENT=$(/bumper increment "${DEFAULT_INCREMENT}" "${GITHUB_EVENT_PATH}")
Expand All @@ -43,4 +43,4 @@ fi
echo ::debug ::Executing bumper release github_repository=${GITHUB_REPOSITORY},github_sha=${GITHUB_SHA},next_tag=${NEXT_TAG},strategy=${RELEASE_STRATEGY}
/bumper release --strategy "${RELEASE_STRATEGY}" "${GITHUB_REPOSITORY}" "${GITHUB_SHA}" "${NEXT_TAG}" "${GITHUB_TOKEN}"

echo ::set-output name=tag::${NEXT_TAG}
echo "tag=${NEXT_TAG}" >> $GITHUB_OUTPUT
29 changes: 21 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
module github.com/K-Phoen/semver-release-action

go 1.13
go 1.19

require (
github.com/blang/semver v3.5.1+incompatible
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-github/v28 v28.1.1
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
github.com/blang/semver/v4 v4.0.0
github.com/google/go-github/v45 v45.2.0
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c
)

replace github.com/K-Phoen/semver-release-action => github.com/krogon/semver-release-action v1.3.2-0.20200201232446-f3f0333ed926
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/k-phoen/semver-release-action => github.com/krogon/semver-release-action v1.3.2-0.20210326053057-7d547fe0e0a5
Loading

0 comments on commit ae370d2

Please sign in to comment.