Files
sub-store/.github/workflows/bridge-proxy.yml
T
2026-07-28 22:49:28 +08:00

81 lines
2.0 KiB
YAML

name: Build Bridge Proxy
on:
push:
branches: [main, master]
paths:
- bridge-proxy/**
- .github/workflows/bridge-proxy.yml
pull_request:
branches: [main, master]
paths:
- bridge-proxy/**
- .github/workflows/bridge-proxy.yml
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/bridge-proxy
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
defaults:
run:
working-directory: bridge-proxy
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: bridge-proxy/go.mod
cache-dependency-path: bridge-proxy/go.mod
- name: Test
run: go test ./...
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./bridge-proxy
file: ./bridge-proxy/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64