Skip to content

Commit

Permalink
feat: first
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Jan 2, 2023
0 parents commit 829a1b9
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: goreleaser

on:
workflow_dispatch:
pull_request:
push:
tags: ['v*']

permissions:
contents: write
id-token: write
packages: write

jobs:
prepare:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- run: echo "flags=" >> $GITHUB_ENV
- if: startsWith(github.ref, 'refs/tags/v')
run: echo "flags=--snapshot" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: 1.19
cache: true
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist*

dist/
41 changes: 41 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This is an example-real .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
- go mod tidy
builds:
- targets: [go_first_class]
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
# trims path
- -trimpath
ldflags:
# use commit date instead of current date as main.date
# only needed if you actually use those things in your main package, otherwise can be ignored.
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release:
name_template: 'v{{ .Version }}'
footer: |
* * *
<a href="https://goreleser.com"><img src="https://raw.githubusercontent.com/goreleaser/artwork/master/opencollective-header.png" with="100%" alt="GoReleaser logo"></a>
Find example-reals and commented usage of all options in our [website](https://goreleaser.com/intro/).
Want to help? You can [sponsor](https://goreleaser.com/sponsors/),get a [Pro License](https://goreleaser.com/pro) or [contribute](https://goreleaser.com/contributing).
Also, feel free to reach out on [Discord](https://discord.gg/RGEBtg8vQ6) and [Twitter](https://twitter.com/goreleaser)!
# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# GoReleaser Action v4 Example: auto-snapshots

Auto-snapshots were removed from GoReleaser GitHub Action in v4.
This repo contains a way to re-enable it with some GitHub-Actions-fu.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module test

go 1.19
Empty file added go.sum
Empty file.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("hello world!")
}

0 comments on commit 829a1b9

Please sign in to comment.