52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout public source without a credential
|
|
env:
|
|
SOURCE_SHA: ${{ github.sha }}
|
|
GIT_TERMINAL_PROMPT: '0'
|
|
run: |
|
|
printf '%s' "$SOURCE_SHA" | grep -Eq '^[a-f0-9]{40}$'
|
|
git init .
|
|
git remote add origin https://git.garvis.dev/dmg/purpur-fantasy-stick.git
|
|
git config --local credential.helper ''
|
|
git config --local http.extraHeader ''
|
|
git config --local http.followRedirects false
|
|
git fetch --force --tags origin '+refs/heads/*:refs/remotes/origin/*'
|
|
git fetch origin "$SOURCE_SHA"
|
|
git checkout --detach "$SOURCE_SHA"
|
|
- name: Set up Java
|
|
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
cache: gradle
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
- name: Validate conventional commits
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.sha }}
|
|
run: |
|
|
npx -y -p @commitlint/cli -p @commitlint/config-conventional \
|
|
commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --extends @commitlint/config-conventional
|
|
- name: Build and test
|
|
run: ./gradlew clean check jar
|
|
- name: Upload development artifact
|
|
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
|
with:
|
|
name: purpur-fantasy-stick-${{ github.sha }}
|
|
path: build/libs/purpur-fantasy-stick-*.jar
|
|
if-no-files-found: error
|