Skip to content

Only run on master branch #17

Only run on master branch

Only run on master branch #17

Workflow file for this run

name: Build and Publish
on: [ push ]
env:
IMAGE_NAME: globallinkserver
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
cache-read-only: ${{ github.ref_name != 'master' && github.ref_name != 'development' }}
- name: Build image
if: ${{ github.repository == 'GeyserMC/GlobalLinkServer' && github.ref_name == 'master' }}
run: docker build . -t $IMAGE_NAME --label "run-number=${GITHUB_RUN_ID}"
- name: Registry login
if: ${{ github.repository == 'GeyserMC/GlobalLinkServer' && github.ref_name == 'master' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
if: ${{ github.repository == 'GeyserMC/GlobalLinkServer' && github.ref_name == 'master' }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Notify Discord
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/GlobalLinkServer' }}
uses: Tim203/actions-git-discord-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}