Init Commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
name: Publish telemt-bot Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- v*
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.shts.su
|
||||
IMAGE_REPO: ${{ gitea.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver-opts: |
|
||||
image=moby/buildkit:v0.13.2
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.ACTIONS_PAT }}
|
||||
|
||||
- name: Prepare Docker tags
|
||||
id: prep
|
||||
shell: bash
|
||||
env:
|
||||
REPO: ${{ gitea.repository }}
|
||||
SHA: ${{ gitea.sha }}
|
||||
REF_NAME: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IMAGE="${REGISTRY}/${REPO}"
|
||||
BRANCH_OR_TAG="${REF_NAME:-unknown}"
|
||||
SAFE_REF="$(echo "${BRANCH_OR_TAG}" | tr '/' '-')"
|
||||
SHORT_SHA="$(echo "${SHA}" | cut -c1-12)"
|
||||
|
||||
TAGS=$(cat <<EOF
|
||||
${IMAGE}:latest
|
||||
${IMAGE}:${SAFE_REF}
|
||||
${IMAGE}:sha-${SHORT_SHA}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo "tags<<EOF" >> "${GITHUB_OUTPUT}"
|
||||
echo "${TAGS}" >> "${GITHUB_OUTPUT}"
|
||||
echo "EOF" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
cache-from: |
|
||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:buildcache
|
||||
cache-to: |
|
||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:buildcache,mode=max
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=telemt-bot
|
||||
org.opencontainers.image.description=Telegram admin bot for Telemt Control API
|
||||
org.opencontainers.image.revision=${{ gitea.sha }}
|
||||
org.opencontainers.image.source=${{ gitea.server_url }}/${{ gitea.repository }}
|
||||
provenance: false
|
||||
Reference in New Issue
Block a user