-
Notifications
You must be signed in to change notification settings - Fork 8
44 lines (35 loc) · 1.2 KB
/
docker-hub.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Docker Hub Image Deploy
on:
push:
branches: ["main", "develop"]
jobs:
docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Extract SERVER_VERSION from launch.sh
id: extract-version
run: |
SERVER_VERSION=$(grep 'SERVER_VERSION=' launch.sh | cut -d '=' -f2)
echo "SERVER_VERSION=$SERVER_VERSION" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push the Docker image (versioned tag)
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/allthemods10:${{ env.SERVER_VERSION }}
- name: Build and push the Docker image (latest tag)
if: ${{ github.ref_name == 'main' }}
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/allthemods10:latest