Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gitmotion committed Oct 23, 2024
1 parent 4e30c70 commit ba44213
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions .github/workflows/gitmotion-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Docker Image Release
name: Build and Push Docker Image

# Trigger workflow when there's a push to the specified branch
on:
push:
branches:
- gitmotion/main # Replace with your target branch (e.g., main or dev)
workflow_dispatch: # Allows manual trigger of the workflow
- gitmotion/main # You can also specify the branch where you want the action to trigger, like `develop`, or your custom branch.

jobs:
ci:
Expand Down Expand Up @@ -35,36 +33,35 @@ jobs:
runs-on: ubuntu-latest
needs:
- ci

steps:
- name: Checkout
uses: actions/checkout@v4 # v4
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3

# Set up Docker Buildx (to support multi-platform builds)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
# Log in to GitHub Container Registry (GHCR)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Build and push Docker images
# Build and push the Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/gitmotion/it-tools:latest
tags: ghcr.io/${{ secrets.GHCR_USERNAME }}/it-tools:latest
# Optionally add version tags or specific branch tags like:
# tags: |
# ghcr.io/${{ secrets.GHCR_USERNAME }}/your-repo-name:latest
# ghcr.io/${{ secrets.GHCR_USERNAME }}/your-repo-name:${{ github.sha }}

# Optionally log out
- name: Log out from GitHub Container Registry
run: docker logout ghcr.io

0 comments on commit ba44213

Please sign in to comment.