Skip to content

Commit

Permalink
feat: add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
vedantmgoyal9 committed Jan 12, 2025
1 parent 2e36fb1 commit 8f927fb
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# .github/workflows/release.yml
name: goreleaser

on:
push:
# run only against tags
tags:
- "*"

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

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/[email protected]
- uses: anchore/sbom-action/[email protected]
- uses: docker/[email protected]
- uses: docker/[email protected]
- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: nightly
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Added by goreleaser init:
dist/
107 changes: 107 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

project_name: example

builds:
- builder: deno
targets:
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

release:
footer: >-
---
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
# Creates Linux packages.
nfpms:
- file_name_template: "{{ .ConventionalFileName }}"
maintainer: Carlos Alexandro Becker <[email protected]>
formats:
- deb
- apk
- rpm

# Creates Darwin universal binaries.
universal_binaries:
- replace: true

# Enables source archives.
source:
enabled: true

# SBOMs for the archives.
sboms:
- artifacts: archive

# Create Docker images.
# We create a manifest below, so here the images need the suffix with the
# architecture.
dockers:
- image_templates:
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-arm64"
dockerfile: Dockerfile
goarch: arm64
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
- image_templates:
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-amd64"
dockerfile: Dockerfile
goarch: amd64
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"

# Here we join both images into a Docker manifest.
docker_manifests:
- name_template: "ghcr.io/goreleaser/example-deno:{{ .Tag }}"
image_templates:
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-arm64"
- "ghcr.io/goreleaser/example-deno:{{ .Tag }}-amd64"
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM debian:12-slim
COPY example /usr/bin/example
ENTRYPOINT [ "/usr/bin/example" ]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# example-deno
Example Deno project using GoReleaser

This uses GoReleaser v2.6+ to build and release a Deno project with GoReleaser.

0 comments on commit 8f927fb

Please sign in to comment.