forked from jet/kube-webhook-certgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update readme; add version file; add gha workflows
- Loading branch information
Showing
12 changed files
with
172 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches-ignore: | ||
- master | ||
- main | ||
permissions: | ||
contents: read | ||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Golang" | ||
uses: "actions/setup-go@v3" | ||
with: | ||
go-version: "1.18" | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: "Modules" | ||
run: "go mod download" | ||
- name: "Lint" | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: "latest" | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
args: "-c ./.golangci.yaml --timeout=10m --issues-exit-code=0 --max-issues-per-linter=0 --sort-results ./..." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
permissions: | ||
contents: write | ||
jobs: | ||
test: | ||
uses: "dejanzele/kube-webhook-certgen/.github/workflows/test.yaml@master" | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
with: | ||
fetch-depth: 0 | ||
- name: "Golang" | ||
uses: "actions/setup-go@v3" | ||
with: | ||
go-version: "1.18" | ||
- name: "Login" | ||
uses: "docker/login-action@v2" | ||
with: | ||
username: "${{ secrets.DOCKERHUB_USERNAME }}" | ||
password: "${{ secrets.DOCKERHUB_SECRET }}" | ||
- name: "Cache" | ||
uses: "actions/cache@v3" | ||
with: | ||
path: "~/go/pkg/mod" | ||
key: "${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}" | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: "Modules" | ||
run: "go mod tidy" | ||
- name: "Release" | ||
uses: "goreleaser/goreleaser-action@v3" | ||
with: | ||
distribution: "goreleaser" | ||
version: "latest" | ||
args: "-f ./.goreleaser.yml release --rm-dist" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: test | ||
on: | ||
workflow_call: | ||
push: | ||
tags: | ||
- v* | ||
branches-ignore: | ||
- master | ||
- main | ||
permissions: | ||
contents: write | ||
jobs: | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
with: | ||
fetch-depth: 0 | ||
- name: "Golang" | ||
uses: "actions/setup-go@v3" | ||
with: | ||
go-version: "1.18" | ||
- name: "Cache" | ||
uses: "actions/cache@v3" | ||
with: | ||
path: "~/go/pkg/mod" | ||
key: "${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}" | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: "Modules" | ||
run: "go mod download" | ||
- name: "Test" | ||
run: go test -json ./internal/... > test.json | ||
- name: "Annotate" | ||
if: always() | ||
uses: guyarb/[email protected] | ||
with: | ||
test-results: test.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.19 |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package core | ||
|
||
import _ "embed" | ||
|
||
var ( | ||
// Version is the current Semantic Version. | ||
Version = "0.0.1-dev" | ||
// BuildTime is the timestamp (ISO-8601) of the build. | ||
BuildTime = "0001-01-01T00:00:00Z" | ||
//go:embed .version | ||
Version string | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
## Tags the git repo using the first argument or the incremented minor version | ||
|
||
set -euo pipefail | ||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd "$dir"/.. | ||
|
||
TGT=${1-none} | ||
if [[ $TGT == "none" ]]; then | ||
TGT=$(git describe --tags | sed -e 's/v//g') | ||
TGT=$(echo "${TGT}" | awk -F. -v OFS=. '{$NF++;print}') | ||
fi | ||
if [[ ${TGT:0:1} == "v" ]]; then | ||
TGT="${TGT:1}" | ||
fi | ||
|
||
echo "$TGT" | ||
|
||
find . -type f -name ".version" -print0 | xargs -0 sed -i '' -e "s/[v]*[0-9]*[0-9]\.[0-9]*[0-9]\.[0-9]*[0-9]/${TGT}/g" | ||
|
||
make build | ||
|
||
git add . | ||
git commit -m "v${TGT}" || true | ||
|
||
git tag "v${TGT}" | ||
|
||
git push | ||
git push --tags |