Skip to content

Docker Publish

Docker Publish #126

name: 'Docker Publish'
on:
push:
tags:
- 'v*.*.*'
schedule:
- cron: '0 0 10,20,30 * *'
permissions:
packages: write
jobs:
publish-stable:
name: Docker Publish
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' && !contains(github.ref, '-') }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Prepare
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.title=vaultwarden-backup
org.opencontainers.image.description=Backup vaultwarden SQLite3/PostgreSQL/MySQL/MariaDB database by rclone
org.opencontainers.image.authors=ttionya
org.opencontainers.image.version=${{ env.VERSION }}
-
name: Build and push
uses: docker/bake-action@v5
env:
VERSION: ${{ env.VERSION }}
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file-labels }}
targets: image-stable
push: true
publish-beta:
name: Docker Publish Beta
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' && contains(github.ref, '-') }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Prepare
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.title=vaultwarden-backup
org.opencontainers.image.description=Backup vaultwarden SQLite3/PostgreSQL/MySQL/MariaDB database by rclone
org.opencontainers.image.authors=ttionya
org.opencontainers.image.version=${{ env.VERSION }}
-
name: Build and push
uses: docker/bake-action@v5
env:
VERSION: ${{ env.VERSION }}
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file-labels }}
targets: image-beta
push: true
publish-schedule:
name: Docker Publish Schedule
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' }}
steps:
-
name: Get Tag
id: tag
uses: pozetroninc/github-action-get-latest-release@v0.8.0
with:
repository: ${{ github.repository }}
excludes: prerelease, draft
-
name: Checkout
uses: actions/checkout@v4
with:
ref: refs/tags/${{ steps.tag.outputs.release }}
-
name: Prepare
run: |
TAG=${{ steps.tag.outputs.release }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.title=vaultwarden-backup
org.opencontainers.image.description=Backup vaultwarden SQLite3/PostgreSQL/MySQL/MariaDB database by rclone
org.opencontainers.image.authors=ttionya
org.opencontainers.image.version=${{ env.VERSION }}
-
name: Build and push
uses: docker/bake-action@v5
env:
VERSION: ${{ env.VERSION }}
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file-labels }}
targets: image-schedule
push: true