Skip to content

Commit

Permalink
Updated flow
Browse files Browse the repository at this point in the history
  • Loading branch information
davisdre committed Sep 11, 2024
1 parent 4da1530 commit f9226b9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/docker-image-main.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
name: Docker image (main)
name: Build and Push Docker Image (Main)

on:
push:
branches:
- "main"
- main # Adjust this to your preferred branch

jobs:
build:
runs-on: ubuntu-latest

steps:
-
name: Login to Docker Hub
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Login to Docker
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ vars.DOCKERHUB_USERNAME }}/littlelink:latest

# Step 3: Build and Push Docker image (Docker CLI is pre-installed in GitHub-hosted runners)
- name: Build and Push Docker Image
run: |
# Build the Docker image
docker build -t ${{ vars.DOCKERHUB_USERNAME }}/littlelink:latest .
# Push the Docker image to Docker Hub
docker push ${{ vars.DOCKERHUB_USERNAME }}/littlelink:latest
27 changes: 17 additions & 10 deletions .github/workflows/docker-image-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker image (release)
name: Build and Push Docker Image (Main)

on:
release:
Expand All @@ -7,18 +7,25 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

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

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

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ vars.DOCKERHUB_USERNAME }}/littlelink:${{ github.event.release.tag_name }}

# Step 3: Build and Push Docker image (Docker CLI is pre-installed in GitHub-hosted runners)
- name: Build and Push Docker Image
run: |
# Build the Docker image
docker build -t ${{ vars.DOCKERHUB_USERNAME }}/littlelink:${{ github.event.release.tag_name }} .
# Push the Docker image to Docker Hub
docker push ${{ vars.DOCKERHUB_USERNAME }}/littlelink:${{ github.event.release.tag_name }}

0 comments on commit f9226b9

Please sign in to comment.