Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release workflow #120

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
# cleanup Runner to avoid "no space left on device" error
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# remove items we don't need
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Checkout code
uses: actions/checkout@v4

- name: Unshallow
run: git fetch --prune --unshallow

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Create release
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --clean --timeout 60m
48 changes: 48 additions & 0 deletions .github/workflows/snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Snapshot

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
# cleanup Runner to avoid "no space left on device" error
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# remove items we don't need
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Checkout code
uses: actions/checkout@v4

- name: Unshallow
run: git fetch --prune --unshallow

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Build snapshot
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --clean --timeout 10m --snapshot
21 changes: 12 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
project_name: k2tf
builds:
- env:
- id: k2tf
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
goarch:
- amd64
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- arm64

checksum:
name_template: "checksums.txt"
archives:
- id: k2tf
builds:
- k2tf
format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ title .Os }}_{{ .Arch }}"
snapshot:
name_template: "{{ .Tag }}-dev"
name_template: "{{ .Tag }}-dev-{{ .ShortCommit }}"
changelog:
sort: asc
filters:
Expand Down
3 changes: 2 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
golang 1.22
golang 1.22
goreleaser latest
Loading