Skip to content

Commit 8cd3b05

Browse files
authored
Create publish-docker.yml
1 parent f1b9289 commit 8cd3b05

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out the repository
12+
uses: actions/checkout@v2
13+
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
17+
- name: Log in to Docker Hub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKER_USERNAME }}
21+
password: ${{ secrets.DOCKER_PASSWORD }}
22+
23+
- name: Extract version from release
24+
id: version_tag
25+
run: |
26+
# Extract the version from the release tag, removing any 'v' prefix
27+
VERSION_TAG="${GITHUB_REF#refs/tags/}"
28+
CLEAN_VERSION=$(echo "$VERSION_TAG" | sed 's/^v//')
29+
echo "##[set-output name=version;]${CLEAN_VERSION}"
30+
31+
# Publish WinArena Base image
32+
33+
- name: Build and push
34+
uses: docker/build-push-action@v2
35+
with:
36+
context: .
37+
file: ./src/win-arena-container/Dockerfile-WinArena-Base
38+
push: true
39+
tags: ${{ secrets.DOCKER_USERNAME }}/winarena-base:${{ steps.version_tag.outputs.version }}
40+
41+
- name: Build and push latest
42+
uses: docker/build-push-action@v2
43+
with:
44+
context: .
45+
file: ./src/win-arena-container/Dockerfile-WinArena-Base
46+
push: true
47+
tags: ${{ secrets.DOCKER_USERNAME }}/winarena-base:latest
48+
49+
# Publish WinArena image
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v2
53+
with:
54+
context: .
55+
file: ./src/win-arena-container/Dockerfile-WinArena
56+
push: true
57+
tags: ${{ secrets.DOCKER_USERNAME }}/winarena:${{ steps.version_tag.outputs.version }}
58+
59+
- name: Build and push latest
60+
uses: docker/build-push-action@v2
61+
with:
62+
context: .
63+
file: ./src/win-arena-container/Dockerfile-WinArena
64+
push: true
65+
tags: ${{ secrets.DOCKER_USERNAME }}/winarena:latest

0 commit comments

Comments
 (0)