Nightly Image Publish #705
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Image Publish | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '4 20 * * *' | |
workflow_dispatch: | |
inputs: | |
sha: | |
description: 'Cassandra trunk commit SHA to build' | |
required: false | |
default: 'HEAD' | |
type: string | |
jobs: | |
build-oss-trunk: | |
strategy: | |
fail-fast: false | |
matrix: | |
cassandra-version: ['5.1'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Cassandra | |
id: checkout_cassandra | |
uses: actions/checkout@v4 | |
with: | |
repository: 'apache/cassandra' | |
- name: Get scheduled Cassandra COMMIT SHA | |
if: ${{ github.event_name == 'schedule' }} | |
id: get_sha_scheduled | |
run: | | |
echo "COMMITSHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Get on-demand Cassandra COMMIT SHA | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
id: get_sha_on_demand | |
run: | | |
echo "COMMITSHA=$(git rev-parse --short ${{ inputs.sha }})" >> $GITHUB_ENV | |
- name: Setup Docker scheduled meta | |
if: ${{ github.event_name == 'schedule' }} | |
id: meta_schedule | |
uses: docker/metadata-action@v5 | |
with: | |
images: k8ssandra/cass-management-api | |
flavor: | | |
prefix=${{ matrix.cassandra-version }}-nightly- | |
tags: | | |
type=raw,value=latest | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
type=raw,value=${{ env.COMMITSHA }} | |
- name: Setup Docker on demand meta | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
id: meta_on_demand | |
uses: docker/metadata-action@v5 | |
with: | |
images: k8ssandra/cass-management-api | |
flavor: | | |
prefix=${{ matrix.cassandra-version }}- | |
tags: | | |
type=raw,value=${{ env.COMMITSHA }} | |
- name: Checkout Management API | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Publish scheduled ${{ matrix.cassandra-version }} to Registry | |
if: ${{ github.event_name == 'schedule' }} | |
id: docker_build_schedule | |
uses: docker/build-push-action@v4 | |
with: | |
file: cassandra-trunk/Dockerfile.ubi8 | |
context: . | |
push: true | |
tags: ${{ steps.meta_schedule.outputs.tags }} | |
platforms: linux/amd64 | |
target: cass-trunk | |
- name: Publish on-demand ${{ matrix.cassandra-version }} to Registry | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
id: docker_build_on_demand | |
uses: docker/build-push-action@v4 | |
with: | |
file: cassandra-trunk/Dockerfile.ubi8 | |
context: . | |
push: true | |
tags: ${{ steps.meta_on_demand.outputs.tags }} | |
platforms: linux/amd64 | |
target: cass-trunk | |
build-args: COMMITSHA=${{ env.COMMITSHA }} |