Build #4
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Build | |
on: | |
schedule: | |
- cron: '0 0 1 * *' | |
workflow_dispatch: | |
push: | |
# branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
- name: Build with Maven | |
run: | | |
mvn versions:set "-DnewVersion=${{ env.GitVersion_SemVer }}" | |
mvn -B package -e --file pom.xml | |
- name: Check status | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: OoliteAddonScanner | |
path: target/OoliteAddonScanner-${{ env.GitVersion_SemVer }}-executable.zip | |
- name: Remove old prereleases | |
if: github.ref != 'refs/heads/main' | |
uses: s00d/[email protected] | |
with: | |
#repo: <owner>/<repoName> # defaults to current repo | |
keep_latest: 3 | |
delete_tag_pattern: v | |
delete_type: 'prerelease' | |
delete_branch: '${{ github.ref_name }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Prerelease | |
if: github.ref != 'refs/heads/main' | |
id: create_prerelease | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "v${{ env.GitVersion_SemVer }}" | |
prerelease: true | |
title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" | |
files: | | |
target/*.zip | |
target/*.tar.gz | |
- name: Remove old releases | |
if: github.ref == 'refs/heads/main' | |
uses: s00d/[email protected] | |
with: | |
#repo: <owner>/<repoName> # defaults to current repo | |
keep_latest: 3 | |
delete_tag_pattern: v | |
delete_type: 'release' | |
delete_branch: 'main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
if: github.ref == 'refs/heads/main' | |
id: create_release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "v${{ env.GitVersion_SemVer }}" | |
prerelease: false | |
title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}" | |
files: | | |
target/*.zip | |
target/*.tar.gz |