Skip to content

Commit

Permalink
Update maven.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzybol authored Mar 17, 2024
1 parent 1e9448c commit efa7b57
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
name: Java CI with Maven, Auto-Versioning, and Release

#
on:
push:
branches: [ "master" ]

permissions:
contents: write

jobs:
build:
build-and-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract_info.outputs.version }}
artifact_name: ${{ steps.extract_info.outputs.artifact_name }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
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:
Expand All @@ -39,35 +34,17 @@ jobs:
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"
create-tag:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create and Push Tag
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@users.noreply.github.com"
git tag ${{ needs.build.outputs.version }}
git push https://x-access-token:${{ secrets.BE_ACCESS_TOKEN }}@github.com/${{ github.repository }} ${{ needs.build.outputs.version }}
create-release:
needs: create-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: minecraft-plugin
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: ${{ needs.build.outputs.artifact_name }}
tag_name: ${{ needs.build.outputs.version }}
name: ${{ steps.extract_info.outputs.artifact_name }}
tag_name: ${{ steps.extract_info.outputs.version }}
files: target/*.jar
generate_release_notes: true
env:
Expand Down

0 comments on commit efa7b57

Please sign in to comment.