mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-01 14:38:55 +00:00
ci: setup using gradle
This commit is contained in:
1 parent
f48ab38b6a
commit
6834d0af4e
11 files changed
+423
-30
No files matched your search
@@ -0,0 +1,50 @@
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
- "master"
|
||||
tags:
|
||||
- "*.*.*"
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
attestations: write
|
||||
contents: write
|
||||
id-token: write
|
||||
checks: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ format('{0}-{1}', github.job, github.ref) }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
uses: ./.github/workflows/test.yml
|
||||
with:
|
||||
os: ubuntu-latest
|
||||
java: 17
|
||||
|
||||
stage:
|
||||
name: Stage
|
||||
needs: test
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: ./.github/workflows/stage.yml
|
||||
with:
|
||||
os: ubuntu-latest
|
||||
java: 17
|
||||
secrets: inherit
|
||||
|
||||
deploy:
|
||||
name: Deploy
|
||||
needs: stage
|
||||
if: github.ref_type == 'tag'
|
||||
uses: ./.github/workflows/deploy.yml
|
||||
with:
|
||||
os: ubuntu-latest
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,67 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
os:
|
||||
description: "The os the workflow shold use"
|
||||
required: false
|
||||
type: string
|
||||
default: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: "Release"
|
||||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
- name: Download Snapshot
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: Release
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
path: "${{ github.workspace }}/tmp/"
|
||||
|
||||
# Generate changelog
|
||||
- name: Generate Changelog
|
||||
uses: ardalanamini/auto-changelog@v4
|
||||
id: changelog
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-types: |
|
||||
feat: New Features
|
||||
fix: Bug Fixes
|
||||
build: Build System & Dependencies
|
||||
perf: Performance Improvements
|
||||
docs: Documentation
|
||||
test: Tests
|
||||
refactor: Refactors
|
||||
chore: Chores
|
||||
ci: CI
|
||||
style: Code Style
|
||||
revert: Reverts
|
||||
default-commit-type: Other Changes
|
||||
release-name: ${{ github.ref_name }}
|
||||
mention-authors: true
|
||||
mention-new-contributors: true
|
||||
include-compare-link: true
|
||||
include-pr-links: true
|
||||
include-commit-links: true
|
||||
semver: true
|
||||
use-github-autolink: true
|
||||
|
||||
# Create release
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
${{ github.workspace }}/tmp/*
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: ${{ contains(github.ref_name, '-RC-') }}
|
||||
generate_release_notes: false
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
@@ -1,30 +0,0 @@
|
||||
name: Build & Upload Release jar with Maven
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
publish_build_files:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: AButler/[email protected]
|
||||
with:
|
||||
files: 'target/SiegeEngines-*.jar'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release-tag: ${{ github.event.release.tag_name }}
|
||||
@@ -0,0 +1,124 @@
|
||||
name: Stage
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
os:
|
||||
description: "The os the workflow shold use"
|
||||
required: false
|
||||
type: string
|
||||
default: ubuntu-latest
|
||||
java:
|
||||
description: "The Java version the workflow should use"
|
||||
required: false
|
||||
type: number
|
||||
default: 17
|
||||
|
||||
permissions:
|
||||
attestations: write
|
||||
contents: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
stage-build-snapshot:
|
||||
name: "Build Snapshot"
|
||||
if: github.ref_type != 'tag'
|
||||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup JDK
|
||||
uses: ./.github/actions/jdk
|
||||
with:
|
||||
java-version: ${{ inputs.java }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./.github/actions/gradle
|
||||
|
||||
# Get version field in project properties file for snapshot version
|
||||
- name: Get Project Version
|
||||
uses: kurt-code/[email protected]
|
||||
id: version
|
||||
with:
|
||||
operation: "read"
|
||||
file-path: "./gradle.properties"
|
||||
keys: "version"
|
||||
|
||||
- name: Set Version Environment Variable
|
||||
run: |
|
||||
echo "CUSTOM_VERSION=${{ steps.version.outputs.version }}-SNAPSHOT-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build -PaltVer=${{ env.CUSTOM_VERSION }} --info
|
||||
|
||||
- name: Upload Snapshot
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Snapshot-${{ github.run_number }}
|
||||
path: ${{ github.workspace }}/build/libs/
|
||||
retention-days: 7
|
||||
|
||||
stage-version:
|
||||
name: "Update Project Version"
|
||||
runs-on: ${{ inputs.os }}
|
||||
if: github.ref_type == 'tag'
|
||||
steps:
|
||||
# Checkout repository
|
||||
- name: Checkout Repository
|
||||
if: contains(github.ref_name, '-RC-') == false
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Update version field in project properties file
|
||||
- name: Update Gradle Project Version
|
||||
if: contains(github.ref_name, '-RC-') == false
|
||||
uses: kurt-code/[email protected]
|
||||
with:
|
||||
operation: "write"
|
||||
file-path: "./gradle.properties"
|
||||
key-value-pairs: '{"version": "${{ github.ref_name }}"}'
|
||||
|
||||
# Commit and push updated version properties file
|
||||
- name: Update repository
|
||||
if: contains(github.ref_name, '-RC-') == false
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "chore: bump version to v${{ github.ref_name }}"
|
||||
branch: ${{ github.event.repository.default_branch }}
|
||||
|
||||
stage-build-release:
|
||||
name: "Build Release"
|
||||
needs: stage-version
|
||||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup JDK
|
||||
uses: ./.github/actions/jdk
|
||||
with:
|
||||
java-version: ${{ inputs.java }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./.github/actions/gradle
|
||||
|
||||
- name: Set Version Environment Variable
|
||||
run: |
|
||||
echo "CUSTOM_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build -PaltVer=${{ env.CUSTOM_VERSION }} -x test --info
|
||||
|
||||
- name: Generate Build Provenance Attestations
|
||||
uses: actions/attest-build-provenance@v1
|
||||
with:
|
||||
subject-path: "${{ github.workspace }}/build/libs/*"
|
||||
|
||||
- name: Upload Snapshot
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Release
|
||||
path: |
|
||||
${{ github.workspace }}/build/libs/
|
||||
${{ github.workspace }}/SiegeEngines-ResourcePack.zip
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,26 @@
|
||||
name: "Close Stale Issues & PRs"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 1 * * *"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
stale-issue-message: "This issue has been automatically marked as stale because it has been open for 60 days with no activity."
|
||||
stale-pr-message: "This PR has been automatically marked as stale because it has been open for 60 days with no activity."
|
||||
close-issue-message: "This issue was closed because it has been stalled for -1 days with no activity."
|
||||
close-pr-message: "This PR was closed because it has been stalled for -1 days with no activity."
|
||||
days-before-issue-stale: 60
|
||||
days-before-pr-stale: 60
|
||||
days-before-issue-close: -1
|
||||
days-before-pr-close: -1
|
||||
stale-issue-label: "stale"
|
||||
stale-pr-label: "stale"
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
os:
|
||||
description: "The os the workflow shold use"
|
||||
required: false
|
||||
type: string
|
||||
default: ubuntu-latest
|
||||
java:
|
||||
description: "The Java version the workflow should use"
|
||||
required: false
|
||||
type: number
|
||||
default: 17
|
||||
|
||||
permissions:
|
||||
checks: write
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
test-build:
|
||||
name: "Run Tests"
|
||||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup JDK
|
||||
uses: ./.github/actions/jdk
|
||||
with:
|
||||
java-version: ${{ inputs.java }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./.github/actions/gradle
|
||||
|
||||
- name: Test with Gradle
|
||||
run: ./gradlew build --info
|
||||
Reference in new issue
Block a user