-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82f947c
commit 83713a5
Showing
6 changed files
with
137 additions
and
251 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Check for new releases | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 2 * * *' | ||
|
||
jobs: | ||
# Todo: matrixify this | ||
check-2024: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get releases | ||
id: get_releases | ||
run: | | ||
curl -s https://api.github.com/repos/tModLoader/tModLoader/releases > output.txt | ||
PRERELEASE=$(jq -r '[.[] | select(.tag_name | contains("2024")) | select(.prerelease == true)] | max_by(.created_at) | .tag_name | sub("^v";"")' output.txt) | ||
RELEASE=$(jq -r '[.[] | select(.tag_name | contains("2024")) | select(.prerelease == false)] | max_by(.created_at) | .tag_name | sub("^v";"")' output.txt) | ||
echo "Latest 2024 pre-release is ${PRERELEASE}." >> "$GITHUB_STEP_SUMMARY" | ||
echo "Latest 2024 release is ${RELEASE}." >> "$GITHUB_STEP_SUMMARY" | ||
echo "latest_prerelease=$LATEST" >> "$GITHUB_OUTPUT" | ||
echo "latest_release=$LATEST" >> "$GITHUB_OUTPUT" | ||
- name: Check if version is already published | ||
id: check_releases | ||
run: | | ||
PRERELEASE=$(curl -s "https://hub.docker.com/v2/repositories/passivelemon/tmodloader1.4-docker/tags/${{ steps.get_releases.outputs.latest_prerelease }}") | ||
RELEASE=$(curl -s "https://hub.docker.com/v2/repositories/passivelemon/tmodloader1.4-docker/tags/${{ steps.get_releases.outputs.latest_release }}") | ||
if echo "$PRERELEASE" | jq -e ".digest" > /dev/null; then | ||
echo "Version ${{ steps.get_releases.outputs.latest_prerelease }} is already published." >> "$GITHUB_STEP_SUMMARY" | ||
echo "prerelease=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "Version ${{ steps.get_releases.outputs.latest_prerelease }} is not already published." >> "$GITHUB_STEP_SUMMARY" | ||
echo "prerelease=false" >> "$GITHUB_OUTPUT" | ||
fi | ||
if echo "$RELEASE" | jq -e ".digest" > /dev/null; then | ||
echo "Version ${{ steps.get_releases.outputs.latest_release }} is already published." >> "$GITHUB_STEP_SUMMARY" | ||
echo "release=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "Version ${{ steps.get_releases.outputs.latest_release }} is not already published." >> "$GITHUB_STEP_SUMMARY" | ||
echo "release=false" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Run Publish workflow (Pre-release) | ||
uses: passivelemon/PassiveLemon/.github/workflows/publish.yml@master | ||
if: ${{ steps.check_releases.outputs.prerelease == true }} | ||
with: | ||
VERSION: ${{ steps.get_releases.outputs.latest_prerelease }} | ||
PRERELEASE: true | ||
|
||
- name: Run Publish workflow (Release) | ||
uses: passivelemon/PassiveLemon/.github/workflows/publish.yml@master | ||
if: ${{ steps.check_releases.outputs.release == true }} | ||
with: | ||
VERSION: ${{ steps.get_releases.outputs.latest_release }} | ||
PRELRELEASE: false | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Build and push Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
VERSION: | ||
description: 'tModLoader version' | ||
required: true | ||
type: string | ||
PRERELEASE: | ||
description: 'If the release is a pre-release' | ||
required: true | ||
type: boolean | ||
secrets: | ||
DOCKER_PASSWORD: | ||
required: true | ||
GHCR_PASSWORD: | ||
required: true | ||
|
||
jobs: | ||
setup-build-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: passivelemon | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_PASSWORD }} | ||
|
||
- name: Build and push Docker image (Pre-release) | ||
uses: docker/build-push-action@v6 | ||
if: ${{ github.event.inputs.PRERELEASE == true }} | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64 | ||
build-args: VERSION=${{ github.event.inputs.VERSION }} | ||
tags: | | ||
passivelemon/tmodloader1.4-docker:latest-2024-pre | ||
passivelemon/tmodloader1.4-docker:${{ github.event.inputs.VERSION }} | ||
ghcr.io/passivelemon/tmodloader1.4-docker:latest-2024-pre | ||
ghcr.io/passivelemon/tmodloader1.4-docker:${{ github.event.inputs.VERSION }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Build and push Docker image (Release) | ||
uses: docker/build-push-action@v6 | ||
if: ${{ github.event.inputs.PRERELEASE == false }} | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64 | ||
build-args: VERSION=${{ github.event.inputs.VERSION }} | ||
tags: | | ||
passivelemon/tmodloader1.4-docker:latest | ||
passivelemon/tmodloader1.4-docker:latest-2024 | ||
passivelemon/tmodloader1.4-docker:${{ github.event.inputs.VERSION }} | ||
ghcr.io/passivelemon/tmodloader1.4-docker:latest | ||
ghcr.io/passivelemon/tmodloader1.4-docker:latest-2024 | ||
ghcr.io/passivelemon/tmodloader1.4-docker:${{ github.event.inputs.VERSION }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|