Skip to content

Commit 8f927fb

Browse files
committed
feat: add goreleaser
1 parent 2e36fb1 commit 8f927fb

File tree

5 files changed

+160
-1
lines changed

5 files changed

+160
-1
lines changed

Diff for: .github/workflows/goreleaser.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# .github/workflows/release.yml
2+
name: goreleaser
3+
4+
on:
5+
push:
6+
# run only against tags
7+
tags:
8+
- "*"
9+
10+
permissions:
11+
contents: write
12+
packages: write
13+
# issues: write
14+
# id-token: write
15+
16+
jobs:
17+
goreleaser:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- uses: denoland/[email protected]
25+
- uses: anchore/sbom-action/[email protected]
26+
- uses: docker/[email protected]
27+
- uses: docker/[email protected]
28+
- uses: docker/[email protected]
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
# More assembly might be required: Docker logins, GPG, etc.
34+
# It all depends on your needs.
35+
- name: Run GoReleaser
36+
uses: goreleaser/goreleaser-action@v6
37+
with:
38+
# either 'goreleaser' (default) or 'goreleaser-pro'
39+
distribution: goreleaser
40+
# 'latest', 'nightly', or a semver
41+
version: nightly
42+
args: release --clean
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
46+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Added by goreleaser init:
2+
dist/

Diff for: .goreleaser.yaml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The lines below are called `modelines`. See `:help modeline`
5+
# Feel free to remove those if you don't want/need to use them.
6+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
7+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8+
9+
version: 2
10+
11+
project_name: example
12+
13+
builds:
14+
- builder: deno
15+
targets:
16+
- x86_64-pc-windows-msvc
17+
- x86_64-apple-darwin
18+
- aarch64-apple-darwin
19+
- x86_64-unknown-linux-gnu
20+
- aarch64-unknown-linux-gnu
21+
22+
archives:
23+
- format: tar.gz
24+
# this name template makes the OS and Arch compatible with the results of `uname`.
25+
name_template: >-
26+
{{ .ProjectName }}_
27+
{{- title .Os }}_
28+
{{- if eq .Arch "amd64" }}x86_64
29+
{{- else if eq .Arch "386" }}i386
30+
{{- else }}{{ .Arch }}{{ end }}
31+
# use zip for windows archives
32+
format_overrides:
33+
- goos: windows
34+
format: zip
35+
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- "^docs:"
41+
- "^test:"
42+
43+
release:
44+
footer: >-
45+
46+
---
47+
48+
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
49+
50+
# Creates Linux packages.
51+
nfpms:
52+
- file_name_template: "{{ .ConventionalFileName }}"
53+
maintainer: Carlos Alexandro Becker <[email protected]>
54+
formats:
55+
- deb
56+
- apk
57+
- rpm
58+
59+
# Creates Darwin universal binaries.
60+
universal_binaries:
61+
- replace: true
62+
63+
# Enables source archives.
64+
source:
65+
enabled: true
66+
67+
# SBOMs for the archives.
68+
sboms:
69+
- artifacts: archive
70+
71+
# Create Docker images.
72+
# We create a manifest below, so here the images need the suffix with the
73+
# architecture.
74+
dockers:
75+
- image_templates:
76+
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-arm64"
77+
dockerfile: Dockerfile
78+
goarch: arm64
79+
use: buildx
80+
build_flag_templates:
81+
- "--pull"
82+
- "--label=org.opencontainers.image.created={{.Date}}"
83+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
84+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
85+
- "--label=org.opencontainers.image.version={{.Version}}"
86+
- "--label=org.opencontainers.image.source={{.GitURL}}"
87+
- "--platform=linux/arm64"
88+
- image_templates:
89+
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-amd64"
90+
dockerfile: Dockerfile
91+
goarch: amd64
92+
use: buildx
93+
build_flag_templates:
94+
- "--pull"
95+
- "--label=org.opencontainers.image.created={{.Date}}"
96+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
97+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
98+
- "--label=org.opencontainers.image.version={{.Version}}"
99+
- "--label=org.opencontainers.image.source={{.GitURL}}"
100+
- "--platform=linux/amd64"
101+
102+
# Here we join both images into a Docker manifest.
103+
docker_manifests:
104+
- name_template: "ghcr.io/goreleaser/example-deno:{{ .Tag }}"
105+
image_templates:
106+
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-arm64"
107+
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-amd64"

Diff for: Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM debian:12-slim
2+
COPY example /usr/bin/example
3+
ENTRYPOINT [ "/usr/bin/example" ]

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# example-deno
2-
Example Deno project using GoReleaser
2+
3+
This uses GoReleaser v2.6+ to build and release a Deno project with GoReleaser.

0 commit comments

Comments
 (0)