jetbra/.github/workflows/release.yml

55 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2024-01-20 13:28:08 +00:00
name: Maven Build and Release
on:
2024-03-13 14:15:10 +00:00
workflow_dispatch:
2024-01-20 13:28:08 +00:00
jobs:
2024-01-20 14:14:49 +00:00
release:
2024-01-20 13:28:08 +00:00
runs-on: ubuntu-latest
2024-01-20 14:14:49 +00:00
permissions:
contents: write
2024-01-20 13:28:08 +00:00
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
2024-01-20 14:14:49 +00:00
2024-01-20 13:28:08 +00:00
- 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 14:07:20 +00:00
- name: Set up Git
run: |
2024-01-20 14:11:00 +00:00
git config user.email "novice88@users.noreply.github.com"
2024-03-13 14:15:10 +00:00
git config user.name "novitechie"
2024-01-20 14:07:20 +00:00
- name: Create Tag
2024-01-20 14:22:07 +00:00
run: git tag -a v${{ github.run_number }} -m "Release version v${{ github.run_number }}"
2024-01-20 14:07:20 +00:00
- name: Push Tag
2024-01-20 14:22:07 +00:00
run: git push origin v${{ github.run_number }}
2024-01-20 14:07:20 +00:00
2024-01-20 13:28:08 +00:00
- name: Create Release
id: create_release
2024-01-20 13:40:50 +00:00
uses: ncipollo/release-action@v1
2024-01-20 13:28:08 +00:00
with:
2024-01-20 14:20:28 +00:00
artifacts: "jetbra-dist/target/jetbra-all.zip"
2024-03-13 14:15:10 +00:00
tag: Jetbra