auto deploy to docker hub
This commit is contained in:
parent
1d6fca2d53
commit
97faf452c6
4 changed files with 43 additions and 5 deletions
|
|
@ -1,2 +1,3 @@
|
|||
README.md
|
||||
.git
|
||||
.git
|
||||
.github
|
||||
37
.github/workflows/docker-hub.yml
vendored
Normal file
37
.github/workflows/docker-hub.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: Docker Hub Image Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
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/login-action@v3.1.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push the Docker image
|
||||
uses: docker/build-push-action@v5.3.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/allthemods10:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/allthemods10:${{ env.SERVER_VERSION }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
description
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
set -x
|
||||
|
||||
NEOFORGE_VERSION=21.1.83
|
||||
SERVER_VERSION=1.27.0
|
||||
cd /data
|
||||
|
||||
if ! [[ "$EULA" = "false" ]]; then
|
||||
|
|
@ -12,10 +13,10 @@ else
|
|||
exit 99
|
||||
fi
|
||||
|
||||
if ! [[ -f 'Server-Files-1.27.0.zip' ]]; then
|
||||
if ! [[ -f "Server-Files-$SERVER_VERSION.zip" ]]; then
|
||||
rm -fr config defaultconfigs kubejs mods packmenu Simple.zip forge*
|
||||
curl -Lo 'Server-Files-1.27.0.zip' 'https://edge.forgecdn.net/files/5965/157/Server-Files-1.27.zip' || exit 9
|
||||
unzip -u -o 'Server-Files-1.27.0.zip' -d /data
|
||||
curl -Lo "Server-Files-SERVER_VERSION.zip" 'https://edge.forgecdn.net/files/5965/157/Server-Files-1.27.zip' || exit 9
|
||||
unzip -u -o "Server-Files-$SERVER_VERSION.zip" -d /data
|
||||
DIR_TEST=$(find . -type d -maxdepth 1 | tail -1 | sed 's/^.\{2\}//g')
|
||||
if [[ $(find . -type d -maxdepth 1 | wc -l) -gt 1 ]]; then
|
||||
cd "${DIR_TEST}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue