Skip to content

Commit

Permalink
Create publish-docker.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
francedot authored Sep 6, 2024
1 parent f1b9289 commit 8cd3b05
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docker Build and Push

on:
release:
types: [created]

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2

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

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract version from release
id: version_tag
run: |
# Extract the version from the release tag, removing any 'v' prefix
VERSION_TAG="${GITHUB_REF#refs/tags/}"
CLEAN_VERSION=$(echo "$VERSION_TAG" | sed 's/^v//')
echo "##[set-output name=version;]${CLEAN_VERSION}"
# Publish WinArena Base image

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./src/win-arena-container/Dockerfile-WinArena-Base
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/winarena-base:${{ steps.version_tag.outputs.version }}

- name: Build and push latest
uses: docker/build-push-action@v2
with:
context: .
file: ./src/win-arena-container/Dockerfile-WinArena-Base
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/winarena-base:latest

# Publish WinArena image

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./src/win-arena-container/Dockerfile-WinArena
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/winarena:${{ steps.version_tag.outputs.version }}

- name: Build and push latest
uses: docker/build-push-action@v2
with:
context: .
file: ./src/win-arena-container/Dockerfile-WinArena
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/winarena:latest

0 comments on commit 8cd3b05

Please sign in to comment.