Skip to content

Commit

Permalink
Add release github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
z0mbix committed Sep 6, 2024
1 parent 1ce0244 commit 6cd2f4f
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
run-name: Release ${{ github.ref_name }} triggered by @${{ github.actor }}

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true

- name: goreleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
rolecule
rolecule.exe
47 changes: 47 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
"-s -w -X github.com/z0mbix/rolecule/cmd.version={{.Version}}"
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
goarm:
- "7"
ignore:
- goos: darwin
goarch: "386"
- goos: windows
goarch: "arm"
binary: "{{ .ProjectName }}"
nfpms:
- vendor: z0mbix
homepage: https://github.com/z0mbix/rolecule
maintainer: z0mbix <[email protected]>
description: |-
Rolecule is a small, simple tool to test your ansible roles
license: GPL-3.0 license
formats:
- apk
- deb
- rpm
archives:
- id: "zip"
format: zip
- id: "tarball"
format: tar.gz
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
changelog:
use: github-native
gomod:
proxy: true
22 changes: 22 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
"github.com/z0mbix/rolecule/pkg/config"
)

func init() {
rootCmd.AddCommand(versionCmd)
}

var version string = "dev"

var versionCmd = &cobra.Command{
Use: "version",
Short: "Show version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("%s %s\n", config.AppName, version)
},
}

0 comments on commit 6cd2f4f

Please sign in to comment.