Skip to content

nightly and on.push docker builds #218

nightly and on.push docker builds

nightly and on.push docker builds #218

name: nightly and on.push docker builds
on:
# to trigger manually if we really need it
workflow_dispatch:
inputs:
tag_name:
description: "the name of the tag for the docker image"
type: "string"
required: true
# to trigger
push:
paths:
- Dockerfile
schedule:
# * is a special character in YAML so you have to quote this string
# triggers every day at 00:00 UTC (midnight)
- cron: '0 0 * * *'
jobs:
docker-amd64:
environment: 'docker'
runs-on: ubuntu-latest
steps:
- 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 Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build and Push
if: ${{ github.event == 'workflow_dispatch' }}
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: |
linux/amd64
tags: |
jessebot/nextcloud:${{ inputs.tag_name }}
# push with ref_name if
- name: Docker Build and Push
if: ${{ github.event != 'workflow_dispatch' && github.event != 'schedule' }}
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: |
linux/amd64
tags: |
jessebot/nextcloud:${{ github.ref_name }}
- name: Get most recent tag
if: ${{ github.event == 'schedule' }}
run: echo "last_tag=$(git describe --tags --abbrev=0) >> $GITHUB_ENV
- name: Docker Build and Push
if: ${{ github.event == 'schedule' }}
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: |
linux/amd64
tags: |
jessebot/nextcloud:nightly
jessebot/nextcloud:${{ env.last_tag }}