-
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.
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
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,70 @@ | ||
name: Public release | ||
# | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
type: choice | ||
options: | ||
- info | ||
- warning | ||
- debug | ||
tags: | ||
description: 'Test scenario tags' | ||
required: false | ||
type: boolean | ||
environment: | ||
description: 'Environment to run tests against' | ||
type: environment | ||
required: true | ||
permissions: | ||
contents: write | ||
jobs: | ||
build-and-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # To ensure tags are fetched as well | ||
token: ${{ secrets.GITHUB_TOKEN }} # Użyj GITHUB_TOKEN do checkout | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build with Maven and Auto-Versioning | ||
run: mvn -B build-helper:parse-version versions:set versions:commit package --file pom.xml | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: minecraft-plugin | ||
path: target/*.jar | ||
- name: Extract version and artifact name | ||
id: extract_info | ||
run: | | ||
JAR_NAME=$(ls target/*.jar) | ||
ARTIFACT_NAME=$(basename $JAR_NAME) | ||
VERSION=$(echo $ARTIFACT_NAME | grep -oP '(?<=-)\d+\.\d+\.\d+(?=-SNAPSHOT)') | ||
echo "::set-output name=version::v$VERSION" | ||
echo "::set-output name=artifact_name::$ARTIFACT_NAME" | ||
- name: Create and Push Tag | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "github-actions@users.noreply.github.com" | ||
git tag ${{ steps.extract_info.outputs.version }} | ||
git push https://x-access-token:${{ secrets.BE_ACCESS_TOKEN }}@github.com/${{ github.repository }} ${{ steps.extract_info.outputs.version }} | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ steps.extract_info.outputs.artifact_name }} | ||
tag_name: ${{ steps.extract_info.outputs.version }} | ||
files: target/*.jar | ||
generate_release_notes: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|