-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
2 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
## | ||
jobs: | ||
release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Auto Increment Semver Action | ||
uses: MCKanpolat/auto-semver-action@v1 | ||
id: versioning | ||
with: | ||
releaseType: patch | ||
incrementPerCommit: true | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Next Release Number | ||
run: echo ${{ steps.versioning.outputs.version }} | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.versioning.outputs.version }} | ||
release_name: Release ${{ steps.versioning.outputs.version }} | ||
body: | | ||
Automatically created release by GitHub Actions | ||
draft: false | ||
prerelease: false | ||
|
||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
version: ${{ steps.versioning.outputs.version }} | ||
|
||
build: | ||
name: Build and Upload | ||
needs: release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml -DskipTests --no-transfer-progress | ||
|
||
- name: List target directory | ||
run: ls -al target | ||
|
||
- name: Check for XenonbanBackend-1.0-SNAPSHOT.jar | ||
id: check_jar | ||
run: | | ||
if [ -f "target/XenonbanBackend-1.0-SNAPSHOT.jar" ]; then | ||
echo "XenonbanBackend-1.0-SNAPSHOT.jar found." | ||
echo "JAR_FILE_PATH=target/XenonbanBackend-1.0-SNAPSHOT.jar" >> $GITHUB_ENV | ||
echo "JAR_FILE_NAME=XenonbanBackend-1.0-SNAPSHOT.jar" >> $GITHUB_ENV | ||
else | ||
echo "XenonbanBackend-1.0-SNAPSHOT.jar not found!" | ||
exit 1 | ||
fi | ||
- name: Upload XenonbanBackend-1.0-SNAPSHOT.jar | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.release.outputs.upload_url }} | ||
asset_path: ${{ env.JAR_FILE_PATH }} | ||
asset_name: ${{ env.JAR_FILE_NAME }} | ||
asset_content_type: application/java-archive | ||
|
||
permissions: | ||
contents: write | ||
packages: write |
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