Skip to content

docker-publish

docker-publish #74

Workflow file for this run

name: docker-publish
on:
push:
workflow_dispatch:
schedule:
- cron: "30 1 11,26 * *" #build bi-monthly
workflow_run:
workflows: ["Update Go Dependencies"]
types: [completed]
jobs:
login:
runs-on: ubuntu-latest
env:
PACKAGE_NAME: singbox
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download update artifact
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: new-updates
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: ./
- name: Check if artifact exists
if: github.event_name == 'workflow_run'
run: |
if [ -f "push-new-updates.txt" ]; then
echo "Artifact found, proceeding with build."
echo "BUILD=true" >> $GITHUB_ENV
else
echo "No artifact found, skipping build."
echo "BUILD=false" >> $GITHUB_ENV
fi
- name: Set build flag for non-workflow_run triggers
if: github.event_name != 'workflow_run'
run: echo "BUILD=true" >> $GITHUB_ENV
- name: Build and push Docker image
if: env.BUILD == 'true'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ env.PACKAGE_NAME }}
platforms: linux/amd64