mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-09-02 18:18:29 +02:00

- Add note about `schedule` event trigger - `BUILD_VERSION` => `GIT_BRANCH` - `Dockerfile-alpine` => `Dockerfile.alpine` - For GHCR username, prefer using `repository_owner` from workflow context which is correct vs `actor` which could be any user capable of triggering the workflow at the repo (which may not align with the expected GHCR username.
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: docker-3.2
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 3.2
|
|
workflow_dispatch:
|
|
# Every week at 8am on Mondays, publish the 3.2 branch:
|
|
# NOTE: `schedule` event is only triggered for the default branch:
|
|
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
|
|
schedule:
|
|
- cron: "0 8 * * 1"
|
|
|
|
env:
|
|
GIT_BRANCH: "3.2"
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- name: Source checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup QEMU
|
|
id: qemu
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Setup Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Set Docker metadata
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ github.repository }}
|
|
labels: |
|
|
org.opencontainers.image.version=${{ env.GIT_BRANCH }}
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
org.opencontainers.image.title=${{ github.repository }}
|
|
|
|
- name: GitHub login
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
context: .
|
|
file: Dockerfile.alpine
|
|
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le
|
|
build-args:
|
|
- GIT_BRANCH
|
|
cache-from: type=gha, scope=${{ github.workflow }}
|
|
cache-to: type=gha, scope=${{ github.workflow }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ env.GIT_BRANCH }}
|
|
ghcr.io/${{ github.repository }}:latest
|