-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Docker hub release workflow #41
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a couple of suggested changes:
name: Publish Docker image
on:
push:
branches: ["main"]
tags: ["v*"]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Use buildx for multi-platform images
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: materialize/datagen
tags: |
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Instead of using SHA values for the action version, I just stuck with latest major version. I think that will suffice. If we want SHA values, we should look up what the latest for each is, because I think some of the ones in this PR are quite out of date.
I added a step for buildx, because it apparently handles multi platform builds for us (i.e. ARM and x86).
For the meta
step, I added semantic versioning. It will automatically create a docker tag based on the semantic version as well as a latest
tag. See example. So for a tag v0.1.0
it would create docker tag 0.1.0
and latest
.
What do you think?
Good points! Just updated this with the suggested changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added Docker credentials to this repository. The username is materializebot
and the password is in DOCKER_HUB_MATERIALIZEBOT_API_KEY
. Here's an example from another repository: https://github.com/MaterializeInc/rr/blob/0afcd9677bbf8a3a851318b592fbb23c3aece57a/.github/workflows/ci.yml#L23-L24
Thank you @benesch! I just updated the credentials accordingly! |
* Add Docker hub release workflow * Update docker workflow * Update the Docker hub creds
Adding a release workflow to publish the Docker image for the datagen to Docker Hub.
Before we merge this, we need to add a
DOCKER_USERNAME
andDOCKER_PASSWORD
secret.Closes #37