Container Images (Cron) #703
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: Container Images (Cron) | |
on: | |
schedule: # Run 2am UTC+8(Beijing) everyday | |
- cron: '0 18 */1 * *' | |
workflow_dispatch: # For manually triggering workflow | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build-and-push-images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Unshallow | |
run: git fetch --prune --unshallow | |
- name: Get Tag | |
id: tagger | |
run: echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT | |
- name: Docker meta for GHCR | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/risingwavelabs/risingwave-operator | |
tags: | | |
type=schedule,prefix=nightly-,pattern={{date 'YYYYMMDD'}} | |
type=ref,event=branch | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=sha | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Docker meta for DockerHub | |
id: dockerhub-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
docker.io/risingwavelabs/risingwave-operator | |
tags: | | |
type=schedule,prefix=nightly-,pattern={{date 'YYYYMMDD'}} | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: build/Dockerfile | |
build-args: | | |
VERSION=${{steps.tagger.outputs.tag}} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: "${{ steps.meta.outputs.tags }}\n${{ steps.dockerhub-meta.outputs.tags }}" | |
labels: ${{ steps.meta.outputs.labels }} |