Skip to content

Commit

Permalink
Merge pull request #120 from sl1pm4t/release-workflow
Browse files Browse the repository at this point in the history
Release workflow
  • Loading branch information
sl1pm4t authored May 19, 2024
2 parents 8b52dfb + 3edc083 commit e84b58b
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 10 deletions.
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

0 comments on commit e84b58b

Please sign in to comment.