Skip to content

Commit

Permalink
chore: adding changes to tools
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Jun 15, 2024
1 parent d169d36 commit e6faaa0
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "zeiss/template-go",
"name": "zeiss/template-action",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
Expand All @@ -24,4 +24,4 @@
]
}
}
}
}
46 changes: 43 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
before:
hooks:
- go mod tidy

builds:
- skip: true
-
id: main
no_unique_dist_dir: true
binary: main-{{ .Arch }}-{{ .Os }}
goos:
- darwin
- linux
- windows
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 7
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
env:
- CGO_ENABLED=0
ldflags:
- -s -w

archives:
- format: binary
name_template: "{{ .Binary }}"
allow_different_binary_count: true

release:
header: |
## Changelog ({{ .Date }})
Welcome to this new release! We hope you enjoy the changes we've made.
changelog:
groups:
- title: Features
Expand All @@ -23,4 +54,13 @@ changelog:
exclude:
- "^docs:"
- typo
- (?i)foo
- (?i)foo

gomod:
proxy: true

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{.Tag}}"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 ZEISS, Sebastian Döll (katallaxie)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 3 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
# :partying_face: Template Go
# Template GitHub Action

> This is a GitHub Template Repository. You can use the green button to create a new repository based on this template. Read more about [GitHub Template Repositories](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template).
## License

## Get Started

This template supports `Makefile` to run tooling.

> `make` is choosen as it is available on most systems.
```bash
# show `help`
make help
```

Other available targets are

* `build`
* `fmt`
* `lint`
* `vet`
* `generate`
* `clean`

The convention is to use `make` to run the build.

Happy coding!
[MIT](/LICENSE)
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: GitHub Action Template
description: This is a GitHub Action using Go
branding:
icon: cloud
color: orange
inputs:
name:
description: ""
required: true
outputs:
id:
description: An example id output.
runs:
using: node20
main: shim/index.js
1 change: 0 additions & 1 deletion example.go

This file was deleted.

2 changes: 1 addition & 1 deletion gen.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package example
package main

//go:generate echo "Generating ..."
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module example
module template

go 1.22

require (
github.com/golang/mock v1.6.0
github.com/golangci/golangci-lint v1.56.2
github.com/sethvargo/go-githubactions v1.2.0
mvdan.cc/gofumpt v0.6.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ github.com/sashamelentyev/usestdlibvars v1.25.0 h1:IK8SI2QyFzy/2OD2PYnhy84dpfNo9
github.com/sashamelentyev/usestdlibvars v1.25.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8=
github.com/securego/gosec/v2 v2.19.0 h1:gl5xMkOI0/E6Hxx0XCY2XujA3V7SNSefA8sC+3f1gnk=
github.com/securego/gosec/v2 v2.19.0/go.mod h1:hOkDcHz9J/XIgIlPDXalxjeVYsHxoWUc5zJSHxcB8YM=
github.com/sethvargo/go-githubactions v1.2.0 h1:Gbr36trCAj6uq7Rx1DolY1NTIg0wnzw3/N5WHdKIjME=
github.com/sethvargo/go-githubactions v1.2.0/go.mod h1:7/4WeHgYfSz9U5vwuToCK9KPnELVHAhGtRwLREOQV80=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/sethvargo/go-githubactions"
)

func main() {
val := githubactions.GetInput("name")
if val == "" {
githubactions.Fatalf("missing 'val'")
}
}
9 changes: 9 additions & 0 deletions shim/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function chooseBinary() {
if (platform === 'linux' && arch === 'x64') {
return `main-linux-amd64-${VERSION}`
}
}

const binary = chooseBinary()
const mainScript = `${__dirname}/dist/${binary}`
const spawnSyncReturns = childProcess.spawnSync(mainScript, { stdio: 'inherit' })

0 comments on commit e6faaa0

Please # to comment.