mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-13 20:18:52 +02:00
feat: add release workflow
This commit is contained in:
41
.github/workflows/release.yml
vendored
Normal file
41
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Releaser workflow setup
|
||||
# https://goreleaser.com/ci/actions/
|
||||
#
|
||||
name: release
|
||||
|
||||
# run only on tags
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write # needed to write releases
|
||||
id-token: write # needed for keyless signing
|
||||
packages: write # needed for ghcr access
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.23
|
||||
cache: true
|
||||
- uses: sigstore/cosign-installer@v3.6.0 # installs cosign
|
||||
- uses: anchore/sbom-action/download-syft@v0.17.2 # installs syft
|
||||
- uses: docker/login-action@v3 # login to ghcr
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: goreleaser/goreleaser-action@v6 # run goreleaser
|
||||
with:
|
||||
version: latest
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
98
.goreleaser.yml
Normal file
98
.goreleaser.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
# .goreleaser.yml
|
||||
project_name: CBZOptimizer
|
||||
release:
|
||||
github:
|
||||
owner: belphemur
|
||||
name: CBZOptimizer
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
- '^chore:'
|
||||
builds:
|
||||
- id: cbzoptimizer
|
||||
main: main.go
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
# ensures mod timestamp to be the commit timestamp
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
flags:
|
||||
# trims path
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w -X meta.Version={{.Version}} -X meta.Commit={{.Commit}} -X meta.Date={{ .CommitDate }}
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
# config the checksum filename
|
||||
# https://goreleaser.com/customization/checksum
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
# create a source tarball
|
||||
# https://goreleaser.com/customization/source/
|
||||
source:
|
||||
enabled: true
|
||||
# proxies from the go mod proxy before building
|
||||
# https://goreleaser.com/customization/gomod
|
||||
gomod:
|
||||
proxy: true
|
||||
# creates SBOMs of all archives and the source tarball using syft
|
||||
# https://goreleaser.com/customization/sbom
|
||||
sboms:
|
||||
- artifacts: archive
|
||||
- id: source # Two different sbom configurations need two different IDs
|
||||
artifacts: source
|
||||
# create a docker image
|
||||
# https://goreleaser.com/customization/docker
|
||||
dockers:
|
||||
- image_templates:
|
||||
- "ghcr.io/belphemur/cbzoptimizer:latest"
|
||||
- "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}"
|
||||
dockerfile: Dockerfile
|
||||
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}}"
|
||||
# signs the checksum file
|
||||
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
|
||||
# https://goreleaser.com/customization/sign
|
||||
signs:
|
||||
- cmd: cosign
|
||||
env:
|
||||
- COSIGN_EXPERIMENTAL=1
|
||||
certificate: "${artifact}.pem"
|
||||
args:
|
||||
- sign-blob
|
||||
- "--output-certificate=${certificate}"
|
||||
- "--output-signature=${signature}"
|
||||
- "${artifact}"
|
||||
- "--yes" # needed on cosign 2.0.0+
|
||||
artifacts: checksum
|
||||
output: true
|
||||
# signs our docker image
|
||||
# https://goreleaser.com/customization/docker_sign
|
||||
docker_signs:
|
||||
- cmd: cosign
|
||||
env:
|
||||
- COSIGN_EXPERIMENTAL=1
|
||||
artifacts: images
|
||||
output: true
|
||||
args:
|
||||
- "sign"
|
||||
- "${artifact}"
|
||||
- "--yes" # needed on cosign 2.0.0+
|
||||
archives:
|
||||
- format: tar.gz
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
- CHANGELOG.md
|
||||
- "CBZOptimizer"
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
FROM alpine:latest
|
||||
LABEL authors="Belphemur"
|
||||
ENV USER=abc
|
||||
ENV CONFIG_FOLDER=/config
|
||||
ENV PUID=99
|
||||
ENV PGID=100
|
||||
RUN mkdir -p "${CONFIG_FOLDER}" && addgroup -g "${PGID}" "${USER}" && adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "$(pwd)" \
|
||||
--ingroup "${USER}" \
|
||||
--no-create-home \
|
||||
--uid "${PUID}" \
|
||||
"${USER}" && \
|
||||
chown ${PUID}:${GUID} /config "${CONFIG_FOLDER}"
|
||||
|
||||
COPY CBZOptimizer /usr/local/bin/CBZOptimizer
|
||||
|
||||
RUN apk add --no-cache inotify-tools && chmod +x /usr/local/bin/CBZOptimizer
|
||||
|
||||
USER ${USER}
|
||||
ENTRYPOINT ["/usr/local/bin/CBZOptimizer"]
|
Reference in New Issue
Block a user