Merge branch 'master' into fix-harvest #2008
Workflow file for this run
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
name: Galaxy Actions | |
on: [ push, pull_request, workflow_dispatch ] | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: cache | |
uses: actions/cache@v4 | |
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@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Gradle | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Build | |
run: ./gradlew --no-daemon build | |
- name: Upload-Artifact | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
- 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@v4 | |
with: | |
name: jar | |
path: docker/mods/Galaxy.jar | |
- name: login | |
if: env.USERNAME != '' && env.PASSWORD != '' | |
uses: docker/login-action@v3 | |
with: | |
registry: 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 |