Skip to content

GHA for push to docker.io #17

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

Merged
merged 3 commits into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
name: Go package

on:
push:
tags:
- "v*" # push events to tagged commits
branches:
- "**"
workflow_dispatch:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you make this change? I think automatically pushing to docker.io on each merge todefang is a good idea.

Why shouldn't we do something like this?

Suggested change
workflow_dispatch:
push:
tags:
- "v*" # push events to tagged commits
branches:
- "defang"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am reluctant to have this auto push until we have a test in place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test of what?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end to end test. The fact that we have to handle differences between anthropic and gemini makes me think regressions will go undetected if we automate pushing.

permissions:
contents: read
id-token: write # for GitHub id-token auth

jobs:
push-docker:
if: startsWith(github.ref, 'refs/tags/v') # only run this step on tagged commits
make-images:
name: Make Docker Images and Push To Registry
if: github.ref == 'refs/heads/defang'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is implied by the suggestion above, so it could be removed here

Suggested change
if: github.ref == 'refs/heads/defang'

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
ref: defang

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU (for multi-arch builds)
uses: docker/setup-qemu-action@v3

- name: Build and push Docker images and manifests
working-directory: src
run: make push-images ${{ startsWith(github.ref, 'refs/tags/v') && format('VERSION={0}', github.ref_name) || '' }}

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Push Docker images
run: make push
on-failure:
runs-on: ubuntu-latest
if: failure() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
needs: [push-docker]
needs: [make-images]
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
Expand Down