mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-01-11 22:39:59 -06:00
106 lines
2.8 KiB
YAML
106 lines
2.8 KiB
YAML
name: Java CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build for JDK ${{ matrix.java }}
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'DreamExposure/DisCal-Discord-Bot' }}
|
|
strategy:
|
|
matrix:
|
|
java: [ 21 ]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Install NPM
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.13.0
|
|
|
|
- name: Set up JDK ${{ matrix.java }}
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: ${{ matrix.java }}
|
|
distribution: 'adopt'
|
|
|
|
- name: Validate gradle
|
|
uses: gradle/actions/wrapper-validation@v3
|
|
|
|
- name: Change wrapper permissions
|
|
run: chmod +x ./gradlew
|
|
|
|
# Build project
|
|
- name: Build with Gradle
|
|
run: ./gradlew clean build
|
|
publish-artifacts:
|
|
name: Publish Artifacts
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name != 'pull_request' && (github.ref_name == 'develop' || github.ref_name == 'master') }}
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Install NPM
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22.13.0
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: 21
|
|
distribution: 'adopt'
|
|
|
|
- name: Change wrapper permissions
|
|
run: chmod +x ./gradlew
|
|
|
|
- name: Publish to CR with Gradle
|
|
uses: Wandalen/wretry.action@master
|
|
env:
|
|
SCW_USER: ${{ secrets.SCW_USER }}
|
|
SCW_SECRET: ${{ secrets.SCW_SECRET }}
|
|
with:
|
|
command: ./gradlew clean jib -Djib.to.auth.username=${SCW_USER} -Djib.to.auth.password=${SCW_SECRET} -Djib.console=plain
|
|
attempt_limit: 25
|
|
# 1 minute in ms
|
|
attempt_delay: 60000
|
|
# deploy-dev:
|
|
# name: Deploy dev
|
|
# runs-on: ubuntu-latest
|
|
# if: github.ref_name == 'develop'
|
|
# needs: publish-artifacts
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
# with:
|
|
# fetch-depth: 0
|
|
#
|
|
# # Have K8S pull latest images for dev pods
|
|
# - name: Trigger dev deploy
|
|
# uses: davi020/kubernetes-action@master
|
|
# env:
|
|
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
|
|
# with:
|
|
# args: delete -n discal pods -l env=dev,app=discal
|