Nightly Image Publish #992
This file contains hidden or 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 commit SHA to build' | |
| required: false | |
| default: 'HEAD' | |
| type: string | |
| branch: | |
| description: 'Cassandra branch to build' | |
| required: false | |
| default: 'trunk' | |
| 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 | |
| echo "CASSANDRA_BRANCH=trunk" >> $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 | |
| echo "CASSANDRA_BRANCH=${{ inputs.branch }}" >> $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 | |
| ghcr.io/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.CASSANDRA_BRANCH }}-${{ env.COMMITSHA }} | |
| - name: Checkout Management API | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| image: tonistiigi/binfmt:qemu-v7.0.0-28 | |
| - 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: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - 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-trunk.ubi | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta_schedule.outputs.tags }} | |
| platforms: linux/amd64,linux/arm64 | |
| target: cassandra | |
| - 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-trunk.ubi | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta_on_demand.outputs.tags }} | |
| platforms: linux/amd64,linux/arm64 | |
| target: cassandra | |
| build-args: COMMITSHA=${{ env.COMMITSHA }}, CASSANDRA_BRANCH=${{ env.CASSANDRA_BRANCH }} |