jetbra/.github/workflows/release.yml

65 lines
1.8 KiB
YAML
Raw Normal View History

2024-01-20 16:28:08 +03:00
name: Maven Build and Release
on:
push:
2024-01-20 17:07:56 +03:00
branches:
- main
2024-01-20 16:28:08 +03:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
- name: Build with Maven
run: mvn clean package
release:
needs: build
runs-on: ubuntu-latest
2024-01-20 16:51:40 +03:00
permissions:
contents: write
2024-01-20 16:28:08 +03:00
steps:
- name: Check Latest Release
id: check_latest_release
run: |
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .id)
echo "::set-output name=latest_release::$LATEST_RELEASE"
- name: Delete Previous Release
if: steps.check_latest_release.outputs.latest_release != 'null'
run: |
# Get the latest release ID
RELEASE_ID=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .id)
# Delete the release
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}"
2024-01-20 17:07:20 +03:00
- name: Set up Git
run: |
git config user.email "${{ GITHUB_ACTOR }}@users.noreply.github.com"
git config user.name "${{ GITHUB_ACTOR }}"
- name: Create Tag
run: git tag -a v${{ github.run_number }} -m "Release version v${{ github.run_number }}"
- name: Push Tag
run: git push origin v${{ github.run_number }}
- name: ls
run: |
ls -l
2024-01-20 16:28:08 +03:00
- name: Create Release
id: create_release
2024-01-20 16:40:50 +03:00
uses: ncipollo/release-action@v1
2024-01-20 16:28:08 +03:00
with:
2024-01-20 16:40:50 +03:00
artifacts: "jetbra-dist/target/jetbra-all.zip"