Skip to content

Commit

Permalink
ci: add CI related
Browse files Browse the repository at this point in the history
Signed-off-by: Ardika Bagus <[email protected]>
  • Loading branch information
ardikabs committed Nov 3, 2023
1 parent 10f16f2 commit 514ef96
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
test:
uses: ./.github/workflows/test.yaml

release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1.21.x

- name: Get Tag
id: tag
uses: devops-actions/[email protected]
with:
strip_v: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: ${{ steps.tag.outputs.tag }}
40 changes: 40 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test

on:
pull_request:
branches:
- main
paths:
- "**/*.go"

workflow_call:

jobs:
audit:
name: Auditing the code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.21.x

- name: Install make
run: |
sudo apt update -y
sudo apt install make curl git -y
- name: Run audit
run: |
make lint
make test
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
file: ./output/coverage.out
43 changes: 43 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 1
before:
hooks:
- go mod tidy

builds:
- binary: helmize
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
goarm:
- "6"
- "7"
ldflags:
- -X github.com/ardikabs/helmize/cmd.Version={{.Version}}
- -X github.com/ardikabs/helmize/cmd.GitCommit={{.Commit}}
ignore:
- goos: windows
goarch: arm64

archives:
- format: binary

changelog:
filters:
exclude:
- "^Release version"
- "^Merge pull request"

checksum:
name_template: "checksums.txt"

release:
github:
owner: ardikabs
name: helmize
name_template: "Version {{.Version}}"

0 comments on commit 514ef96

Please sign in to comment.