Skip to content

Commit

Permalink
Added: CI workflow to build & push Docker image on release
Browse files Browse the repository at this point in the history
  • Loading branch information
filiprojek committed Jan 23, 2025
1 parent 7840778 commit 315317e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-and-push-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Push Docker Image to Docker Hub

on:
release:
types: [published]

env:
DOCKER_REPO: ${{ secrets.DOCKER_HUB_USERNAME }}/walauncher

jobs:
build-and-push:
runs-on: ubuntu-latest

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

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

- name: Extract release version
id: extract_version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Build Docker image
run: |
docker build -t ${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }} .
docker tag ${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }} ${{ env.DOCKER_REPO }}:latest
- name: Push Docker image
run: |
docker push ${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }}
docker push ${{ env.DOCKER_REPO }}:latest

0 comments on commit 315317e

Please sign in to comment.