75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
# Inspired by:
|
|
# https://blog.gitea.com/creating-go-actions/
|
|
# https://gitea.com/Zettat123/test-simple-go-action/src/branch/main/.gitea/workflows/call-username.yml
|
|
# https://gitea.com/actions/release-action
|
|
# https://gitea.com/gitea/runner-images
|
|
# https://github.com/vegardit/docker-gitea-act-runner
|
|
# https://github.com/catthehacker/docker_images
|
|
#
|
|
---
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: build-image
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 🚀 🚀
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- .gitea/workflows/build-image.yaml
|
|
|
|
jobs:
|
|
build-image:
|
|
name: build-image
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
# image: ghcr.io/catthehacker/ubuntu:act-latest
|
|
# image: gitea/runner-images:ubuntu-latest
|
|
image: ghcr.io/catthehacker/ubuntu:act-latest
|
|
# credentials:
|
|
# username: ${{ gitea.actor }}
|
|
# password: ${{ secrets.GA_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install QEMU
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y qemu-user-static
|
|
#
|
|
# https://github.com/docker/metadata-action
|
|
#
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
gitea.example.com/xyz/alpine
|
|
tags: |
|
|
type=schedule,pattern={{date 'YYYYMMDDHHMM'}}
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha
|
|
- name: Set up Docker Context for Buildx
|
|
id: buildx-context
|
|
run: |
|
|
export DOCKER_HOST=tcp://docker:2376/
|
|
export DOCKER_TLS_CERTDIR="/certs"
|
|
export DOCKER_TLS_VERIFY=1
|
|
export DOCKER_CERT_PATH="/certs/client"
|
|
docker context create builders
|
|
# https://github.com/docker/setup-buildx-action
|
|
# https://docs.docker.com/engine/reference/commandline/cli/#environment-variables
|
|
- name: Setup Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
# buildkitd-flags: --debug
|
|
endpoint: builders
|
|
env:
|
|
DOCKER_HOST: "tcp://docker:2376/"
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
DOCKER_TLS_VERIFY: 1
|
|
DOCKER_CERT_PATH: "/certs/client" |