init
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
name: Publish mtproxy_checker Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- "*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
GO_VERSION: "1.22"
|
||||
REGISTRY: git.shts.su
|
||||
IMAGE_REPO: ${{ gitea.repository }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Test
|
||||
run: go mod tidy && go test ./...
|
||||
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
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="$(printf '%s\n%s\n%s\n' \
|
||||
"${IMAGE}:latest" \
|
||||
"${IMAGE}:${SAFE_REF}" \
|
||||
"${IMAGE}:sha-${SHORT_SHA}")"
|
||||
|
||||
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 }}:latest
|
||||
cache-to: type=inline
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=mtproxy_checker
|
||||
org.opencontainers.image.description=CLI probe for MTProxy (ee Fake-TLS + dd), Telegram-style ClientHello
|
||||
org.opencontainers.image.revision=${{ gitea.sha }}
|
||||
org.opencontainers.image.source=${{ gitea.server_url }}/${{ gitea.repository }}
|
||||
provenance: false
|
||||
Reference in New Issue
Block a user