Skip to content

v1.0.1

v1.0.1 #5

Workflow file for this run

name: CD Pipeline
on:
release:
types: [published]
jobs:
push:
name: Push Docker Image to Registry
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v2
# Step 2: Set up Docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 3: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Step 4: Extract version from release tag
- name: Extract Version from Release Tag
run: |
VERSION=${GITHUB_REF##*/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
# Step 5: Build Docker Image
- name: Build Docker Image
run: |
# Build Docker image
docker build -t narmidm/k8stoolbox:latest -f docker/Dockerfile .
# Tag the Docker image with the release version
docker tag narmidm/k8stoolbox:latest narmidm/k8stoolbox:${{ env.VERSION }}
# Step 6: Push Docker Image with Latest and Version Tags
- name: Push Docker Image
run: |
# Ensure the image is built and tagged successfully
docker images
# Push Docker image with latest tag
docker push narmidm/k8stoolbox:latest
# Push Docker image with version tag
docker push narmidm/k8stoolbox:${{ env.VERSION }}