mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-01-22 13:48:43 -05:00
96 lines
3.1 KiB
YAML
Executable File
96 lines
3.1 KiB
YAML
Executable File
# This workflow uses actions that are not certified by GitHub.
|
|
# They are provided by a third-party and are governed by
|
|
# separate terms of service, privacy policy, and support
|
|
# documentation.
|
|
|
|
# GitHub recommends pinning actions to a commit SHA.
|
|
# To get a newer version, you will need to update the SHA.
|
|
# You can also reference a tag or branch, but the action may change without warning.
|
|
name: Publish Docker image
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# --- Get release version from tag
|
|
- name: Get release version
|
|
id: get_version
|
|
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
# --- debug output
|
|
- name: Debug version
|
|
run: |
|
|
echo "GITHUB_REF: $GITHUB_REF"
|
|
echo "Version: '${{ steps.get_version.outputs.version }}'"
|
|
|
|
# --- Write version to .VERSION file
|
|
- name: Create .VERSION file
|
|
run: echo -n "${{ steps.get_version.outputs.version }}" > .VERSION
|
|
|
|
# --- Generate Docker metadata and tags
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
ghcr.io/netalertx/netalertx
|
|
ghcr.io/jokob-sk/netalertx
|
|
jokobsk/netalertx
|
|
tags: |
|
|
type=semver,pattern={{version}},value=${{ steps.get_version.outputs.version }}
|
|
type=semver,pattern={{major}}.{{minor}},value=${{ steps.get_version.outputs.version }}
|
|
type=semver,pattern={{major}},value=${{ steps.get_version.outputs.version }}
|
|
type=raw,value=latest
|
|
|
|
- name: Log in to Github Container Registry (GHCR)
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login GHCR (jokob-sk legacy)
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: jokob-sk
|
|
password: ${{ secrets.GHCR_JOKOBSK_PAT }}
|
|
|
|
- name: Log in to DockerHub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
# cache-from: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache
|
|
# cache-to: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache,mode=max
|