-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: CI workflow to build & push Docker image on release
- Loading branch information
1 parent
7840778
commit 315317e
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |