ytdl-web/.gitea/workflows/release.yaml

61 lines
2.0 KiB
YAML

---
name: Release
# yamllint disable-line rule:truthy
on:
push:
tags:
- "*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: https://github.com/goreleaser/goreleaser-action@v2
with:
version: latest
args: release --snapshot --clean
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
docker:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: git.fifitido.net/apps/ytdl-web
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
type=sha
- name: Setup QEMU
uses: https://github.com/docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v2
- name: Login to Docker Registry
uses: https://github.com/docker/login-action@v2
with:
registry: git.fifitido.net
username: ${{ gitea.repository_owner }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Build and push
uses: https://github.com/docker/build-push-action@v4
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# yamllint disable rule:line-length
build-args: |
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILT_BY=Gitea Actions
# yamllint enable rule:line-length