diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6d385b1 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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/free-disk-space@v1.3.1 + 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 \ No newline at end of file diff --git a/.github/workflows/snapshot.yaml b/.github/workflows/snapshot.yaml new file mode 100644 index 0000000..80f3d06 --- /dev/null +++ b/.github/workflows/snapshot.yaml @@ -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/free-disk-space@v1.3.1 + 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 \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 6a199d8..8121f5a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,7 @@ +project_name: k2tf builds: - - env: + - id: k2tf + env: - CGO_ENABLED=0 goos: - darwin @@ -7,17 +9,18 @@ builds: - 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: diff --git a/.tool-versions b/.tool-versions index 48e0dab..fea2dc9 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ -golang 1.22 +golang 1.22 +goreleaser latest