-
Notifications
You must be signed in to change notification settings - Fork 52
96 lines (94 loc) · 3.22 KB
/
nightly_image_publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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.0']
runs-on: ubuntu-latest
steps:
- name: Checkout Cassandra
id: checkout_cassandra
uses: actions/checkout@v3
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@v4
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@v4
with:
images: k8ssandra/cass-management-api
flavor: |
prefix=${{ matrix.cassandra-version }}-
tags: |
type=raw,value=${{ env.COMMITSHA }}
- name: Checkout Management API
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v2
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@v3
with:
file: cassandra-trunk/Dockerfile.ubi8
context: .
push: true
tags: ${{ steps.meta_schedule.outputs.tags }}
platforms: linux/amd64,linux/arm64
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@v3
with:
file: cassandra-trunk/Dockerfile.ubi8
context: .
push: true
tags: ${{ steps.meta_on_demand.outputs.tags }}
platforms: linux/amd64,linux/arm64
target: cass-trunk
build-args: COMMITSHA=${{ env.COMMITSHA }}