Skip to content

Merge branch 'master' into weapon #1913

Merge branch 'master' into weapon

Merge branch 'master' into weapon #1913

Workflow file for this run

name: Galaxy Actions
on: [ push, pull_request, workflow_dispatch ]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/loom-cache
key: caches-${{ hashFiles('build.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
caches-
- name: JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Gradle
uses: gradle/wrapper-validation-action@v1
- name: Build
run: ./gradlew --no-daemon build
- name: Upload-Artifact
uses: actions/upload-artifact@v3
with:
name: jar
path: build/libs/Galaxy.jar
Docker-image:
needs: Build
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
REGISTRY_IMAGE: harbor.k8s.oktw.one/galaxy/galaxy
USERNAME: ${{ secrets.OKTW_HARBOR_USERNAME }}
PASSWORD: ${{ secrets.OKTW_HARBOR_PASSWORD }}
steps:
- name: Env
shell: bash
run: echo IMAGE_TAG=$([ "$GITHUB_REF" = "refs/heads/master" ] && echo "latest" || ([ "$GITHUB_EVENT_NAME" = 'pull_request' ] && echo pr-${{github.event.pull_request.number}} || echo ${GITHUB_REF##*/})) >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- uses: actions/download-artifact@v3
with:
name: jar
path: docker/mods/Galaxy.jar
- name: login
if: env.USERNAME != '' && env.PASSWORD != ''
uses: azure/docker-login@v1
with:
login-server: harbor.k8s.oktw.one
username: ${{ secrets.OKTW_HARBOR_USERNAME }}
password: ${{ secrets.OKTW_HARBOR_PASSWORD }}
- name: build cache
if: github.ref == 'refs/heads/master' && env.USERNAME != '' && env.PASSWORD != ''
working-directory: ./docker
run: |
docker build --build-arg BUILDKIT_INLINE_CACHE=1 --pull --cache-from $REGISTRY_IMAGE:build-cache -t $REGISTRY_IMAGE:build-cache --target builder .
docker push $REGISTRY_IMAGE:build-cache
- name: build
working-directory: ./docker
run: docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $REGISTRY_IMAGE:build-cache --cache-from $REGISTRY_IMAGE:latest -t $REGISTRY_IMAGE:$IMAGE_TAG .
- name: push
if: env.USERNAME != '' && env.PASSWORD != ''
run: docker push $REGISTRY_IMAGE:$IMAGE_TAG