* Pipeline

* set expectation

* Run subsequently

* Finalization

* Altered the job
This commit is contained in:
Michael
2021-04-26 14:34:36 -07:00
committed by GitHub
parent 62249670b3
commit c41079e1d3
10 changed files with 1941 additions and 115 deletions

11
.autorc Normal file
View File

@@ -0,0 +1,11 @@
{
"plugins": [
"git-tag",
"all-contributors"
],
"owner": "mbround18",
"repo": "valheim-docker",
"name": "mbround18",
"email": "12646562+mbround18@users.noreply.github.com",
"onlyPublishWithReleaseLabel": true
}

View File

@@ -1 +1 @@
* @mbround18
- @mbround18

View File

@@ -1,12 +1,13 @@
# Description
## Contributions
- I changed x because y
- I added the new feature x.
- I changed x because y
- I added the new feature x.
## Checklist
- [ ] I added one or multiple labels which best describes this PR.
- [ ] I have tested the changes locally.
- [ ] This PR has a reviewer on it.
- [ ] This PR has a reviewer on it.
- [ ] I have validated my changes in a docker container and on Ubuntu. (Only needed for Odin or Docker Changes)

View File

@@ -11,133 +11,118 @@ on:
# Run tests for any PRs.
pull_request:
env:
DOCKER_IMAGE_NAME: mbround18/valheim
CARGO_TERM_COLOR: always
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
image: [odin, valheim]
steps:
- uses: actions/checkout@v2
- name: Build Odin
run: |
# Gather Utils
. ./.github/scripts/utils.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Parse version
VERSION="${GITHUB_REF}"
VERSION="$(parse_version)"
echo VERSION=$VERSION
docker-compose \
--file docker-compose.yml \
build odin
- name: Build Valheim
run: |
docker-compose \
--file docker-compose.yml build \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
--build-arg GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" \
valheim
push_odin:
needs: test
- name: Build ${{ matrix.image }}
id: docker_build
uses: docker/build-push-action@v2
with:
file: ./Dockerfile.${{ matrix.image }}
push: false
tags: mbround18/${{ matrix.image }}:latest
build-args: |
"GITHUB_SHA=${GITHUB_SHA}"
"GITHUB_REF=${GITHUB_REF}"
"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
- name: Finalization
run: echo "Finalized"
push:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push'
strategy:
fail-fast: true
max-parallel: 1
matrix:
image: [odin, valheim]
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
# list of Docker images to use as base name for tags
images: |
mbround18/${{ matrix.image }}
ghcr.io/mbround18/${{ matrix.image }}
- name: Log into registry
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
echo "${{ secrets.DOCKER_TOKEN }}" | docker login registry.hub.docker.com -u mbround18 --password-stdin
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
run: |
docker build . \
--file Dockerfile.odin \
--tag "${DOCKER_IMAGE_NAME}-odin"
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: mbround18
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push Image
run: |
# Gather Utils
. ./.github/scripts/utils.sh
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
# Parse variables
IMAGE_ID=$DOCKER_IMAGE_NAME-odin
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.${{ matrix.image }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"GITHUB_SHA=${GITHUB_SHA}"
"GITHUB_REF=${GITHUB_REF}"
"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
# Change all uppercase to lowercase
IMAGE_ID="${IMAGE_ID,,}"
# Parse version
VERSION="${GITHUB_REF}"
VERSION="$(parse_version)"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
- uses: borales/actions-yarn@v2.0.0
with:
cmd: install
docker tag "${DOCKER_IMAGE_NAME}-odin" registry.hub.docker.com/$IMAGE_ID:$VERSION
docker tag "${DOCKER_IMAGE_NAME}-odin" ghcr.io/$IMAGE_ID:$VERSION
docker push registry.hub.docker.com/$IMAGE_ID:$VERSION
docker push ghcr.io/$IMAGE_ID:$VERSION
push_valheim:
# Ensure test job passes before pushing image.
needs: push_odin
- uses: borales/actions-yarn@v2.0.0
with:
cmd: auto shipit
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Log into registry
- name: Send Release Notification
if: github.event_name != 'pull_request' && "${{ matrix.image }}" == "valheim"
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
echo "${{ secrets.DOCKER_TOKEN }}" | docker login registry.hub.docker.com -u mbround18 --password-stdin
- name: Build image
run: |
docker build . \
--file Dockerfile \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
--build-arg GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" \
--tag $DOCKER_IMAGE_NAME
- name: Push Image to DockerHub
run: |
# Gather Utils
. ./.github/scripts/utils.sh
# Parse variables
IMAGE_ID=$DOCKER_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID="${IMAGE_ID,,}"
# Parse version
VERSION="${GITHUB_REF}"
VERSION="$(parse_version)"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $DOCKER_IMAGE_NAME registry.hub.docker.com/$IMAGE_ID:$VERSION
docker tag $DOCKER_IMAGE_NAME ghcr.io/$IMAGE_ID:$VERSION
docker push registry.hub.docker.com/$IMAGE_ID:$VERSION
docker push ghcr.io/$IMAGE_ID:$VERSION
# Send release notification
docker run --rm \
-e NAME="New Version: ${DOCKER_IMAGE_NAME}:${VERSION}" \
mbround18/valheim-odin:$VERSION notify "New release of ${DOCKER_IMAGE_NAME}:${VERSION} !! Please use pull the latest ${DOCKER_IMAGE_NAME}:${VERSION}. Then restart your server via your preferred method." \
-e NAME="New Version: ${{ matrix.image }}:latest" \
mbround18/odin:latest notify "New release of ${{ matrix.image }}:latest !! Please use pull the latest ${DOCKER_IMAGE_BASE}:${VERSION}. Then restart your server via your preferred method." \
--webhook "${{ secrets.RELEASE_WEBHOOK }}"

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ tmp/
*.env*
docker-compose.*.yml
release
node_modules/

View File

@@ -13,13 +13,12 @@ If you purely want to run this on a Linux based system, without docker, take a l
- [Installing & Using Odin](./src/odin/README.md)
The tool [Odin] runs the show and does almost all the heavy lifting in this repo. It starts, stops, and manages your Valheim server instance.
- [Installing & Using Huginn](./src/huginn/README.md)
Looking for a way to view the status of your server? Look no further than [Huginn]!
Looking for a way to view the status of your server? Look no further than [Huginn]!
The [Huginn] project is a http server built on the same source as [Odin] and uses these capabilities to expose a few http endpoints.
> Using the binaries to run on an Ubuntu Server, you will have to be more involved and configure a few things manually.
> If you want a managed, easy one-two punch to manage your server. Then look at the Docker section <3
> Using the binaries to run on an Ubuntu Server, you will have to be more involved and configure a few things manually.
> If you want a managed, easy one-two punch to manage your server. Then look at the Docker section <3
## Running with Docker
@@ -57,7 +56,6 @@ If you purely want to run this on a Linux based system, without docker, take a l
| WEBHOOK_URL | `<nothing>` | FALSE | Supply this to get information regarding your server's status in a webhook or Discord notification! [Click here to learn how to get a webhook url for Discord](https://help.dashe.io/en/articles/2521940-how-to-create-a-discord-webhook-url) |
| UPDATE_ON_STARTUP | `1` | FALSE | Tries to update the server the container is started. |
#### Container Env Variables
| Variable | Default | Required | Description |
@@ -203,6 +201,10 @@ If you would like to have release notifications tied into your Discord server, c
**Note**: The discord is PURELY for release notifications and any + all permissions involving sending chat messages has been disabled.
[Any support for this repository must take place on the Discussions.](https://github.com/mbround18/valheim-docker/discussions)
# Contributions
- @some_guy - design, doc
## Versions
- latest (Stable):

View File

@@ -20,7 +20,7 @@ services:
AUTO_UPDATE_SCHEDULE: "0 1 * * *"
build:
context: .
dockerfile: ./Dockerfile
dockerfile: ./Dockerfile.valheim
ports:
- "2456:2456/udp"
- "2457:2457/udp"

13
package.json Normal file
View File

@@ -0,0 +1,13 @@
{
"name": "valheim",
"version": "1.0.0",
"main": "index.js",
"repository": "git@github.com:mbround18/valheim-docker.git",
"author": "mbround18 <12646562+mbround18@users.noreply.github.com>",
"license": "MIT",
"devDependencies": {
"@auto-it/all-contributors": "^10.25.1",
"@auto-it/git-tag": "^10.25.1",
"auto": "^10.25.1"
}
}

1813
yarn.lock Normal file

File diff suppressed because it is too large Load Diff