Early adapter #21
Workflow file for this run
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
# This workflow will build a Java project with Gradle | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: | |
- main | |
- early-adapter | |
pull_request: | |
branches: | |
- main | |
- early-adapter | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 19 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'oracle' | |
java-version: '19' | |
cache: 'gradle' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Creating the jar file | |
run: ./gradlew jar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./releases/*.jar | |
name: Downloadable Extension File | |
- name: Extract version | |
id: get_version | |
run: | | |
VERSION=$(grep "^version=" src/main/resources/extension.properties | awk -F'=' '{print $2}') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Set release tag based on branch | |
id: vars | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
echo "RELEASE_TAG=main_${VERSION}_by_github" >> $GITHUB_ENV | |
else | |
echo "RELEASE_TAG=early_adapter_${VERSION}_by_github" >> $GITHUB_ENV | |
fi | |
- name: Delete the tag | |
run: | | |
TAG_TO_DELETE=$RELEASE_TAG | |
curl -X DELETE \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/git/refs/tags/$TAG_TO_DELETE" | |
- name: Release | |
uses: irsdl/release-action@v1.12.0 | |
with: | |
tag: ${{ env.RELEASE_TAG }} | |
body: "This jar file has been built by GitHub automatically.\nYou can view the latest version number in the [extension.properties](../../blob/main/src/main/resources/extension.properties) file." | |
allowUpdates: true | |
artifacts: "releases/*.jar" |