mirror of
https://github.com/Xevion/glance.git
synced 2025-12-07 03:15:14 -06:00
Add release workflow using GoReleaser
This commit is contained in:
59
.github/workflows/release.yaml
vendored
Normal file
59
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
name: Create release
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Only run the workflow when a tag that starts with "v" (e.g. "v1.2.3") is pushed.
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the target Git reference
|
||||||
|
# https://github.com/actions/checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Log in to the GitHub Packages registry
|
||||||
|
# https://github.com/docker/login-action
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
env:
|
||||||
|
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
# Skip this step if credentials are not present.
|
||||||
|
if: ${{ env.dockerhub_username && env.dockerhub_token }}
|
||||||
|
# https://github.com/docker/login-action
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Golang
|
||||||
|
# https://github.com/actions/setup-go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Set up Docker buildx
|
||||||
|
# https://github.com/docker/setup-buildx-action
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
# https://github.com/goreleaser/goreleaser-action
|
||||||
|
uses: goreleaser/goreleaser-action@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: release
|
||||||
103
.goreleaser.yaml
Normal file
103
.goreleaser.yaml
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||||
|
# .goreleaser.yaml
|
||||||
|
# ref: https://goreleaser.com/customization/
|
||||||
|
|
||||||
|
project_name: wfg/glance
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- binary: glance
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- freebsd
|
||||||
|
- linux
|
||||||
|
- openbsd
|
||||||
|
- windows
|
||||||
|
|
||||||
|
archives:
|
||||||
|
# Defaults to .tar.gz; override Windows to .zip.
|
||||||
|
- format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
|
||||||
|
dockers:
|
||||||
|
# Build linux/amd64 image
|
||||||
|
- use: buildx
|
||||||
|
goarch: amd64
|
||||||
|
dockerfile: goreleaser.Dockerfile
|
||||||
|
image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/amd64
|
||||||
|
|
||||||
|
# Build linux/arm64/v7 image
|
||||||
|
- use: buildx
|
||||||
|
goarch: arm64
|
||||||
|
dockerfile: goreleaser.Dockerfile
|
||||||
|
image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64v7"
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64v7
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/arm64/v7
|
||||||
|
|
||||||
|
# Build linux/arm64 image
|
||||||
|
- use: buildx
|
||||||
|
goarch: arm64
|
||||||
|
dockerfile: goreleaser.Dockerfile
|
||||||
|
image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
build_flag_templates:
|
||||||
|
- --platform=linux/arm64
|
||||||
|
|
||||||
|
|
||||||
|
docker_manifests:
|
||||||
|
# Bundle images into a single multi-arch image
|
||||||
|
|
||||||
|
# glanceapp/glance:${tag}
|
||||||
|
# Creates tags for "v1.2.3", "v1.2", "v1", and latest
|
||||||
|
# - name_template: "{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
|
||||||
|
# image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64v7"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
# - name_template: {{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}
|
||||||
|
# image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64v7"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
# - name_template: {{ .ProjectName }}:v{{ .Major }}
|
||||||
|
# image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64v7"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
# - name_template: {{ .ProjectName }}:latest
|
||||||
|
# image_templates:
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64v7"
|
||||||
|
# - "{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
|
||||||
|
# ghcr.io/glanceapp/glance
|
||||||
|
# Creates tags for "v1.2.3", "v1.2", "v1", and latest
|
||||||
|
- name_template: ghcr.io/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}
|
||||||
|
image_templates:
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64v7
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
- name_template: ghcr.io/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}
|
||||||
|
image_templates:
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64v7
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
- name_template: ghcr.io/{{ .ProjectName }}:v{{ .Major }}
|
||||||
|
image_templates:
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64v7
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
|
- name_template: ghcr.io/{{ .ProjectName }}:latest
|
||||||
|
image_templates:
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64v7
|
||||||
|
- ghcr.io/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||||
9
goreleaser.Dockerfile
Normal file
9
goreleaser.Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# This binary is an artifact from goreleaser.
|
||||||
|
COPY glance .
|
||||||
|
ENTRYPOINT ["/app/glance"]
|
||||||
|
|
||||||
|
EXPOSE 8080/tcp
|
||||||
Reference in New Issue
Block a user