release.yml
This commit is contained in:
parent
79e7127c4a
commit
2215830d19
|
@ -0,0 +1,55 @@
|
||||||
|
name: Maven Build and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
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
|
||||||
|
|
||||||
|
- 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}"
|
||||||
|
|
||||||
|
- name: Set up Git
|
||||||
|
run: |
|
||||||
|
git config user.email "novice88@users.noreply.github.com"
|
||||||
|
git config user.name "novitechie"
|
||||||
|
|
||||||
|
- name: Create Tag
|
||||||
|
run: git tag -a release -m "release"
|
||||||
|
|
||||||
|
- name: Push Tag
|
||||||
|
run: git push origin release
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
artifacts: "target/privacy.jar"
|
||||||
|
tag: release
|
Loading…
Reference in New Issue