Merge pull request #3 from Paulanerus/dev #14
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
name: Build and Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ github.token }} | |
outputs: | |
version: ${{ steps.extract_version.outputs.ver }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Extract App Version | |
id: extract_version | |
run: echo "ver=$(grep 'app.version=' gradle.properties | cut -d '=' -f2)" >> $GITHUB_OUTPUT | |
- name: Create Release | |
run: gh release create v${{ steps.extract_version.outputs.ver }} --generate-notes | |
build-api: | |
needs: create-release | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ github.token }} | |
VERSION: ${{ needs.create-release.outputs.version }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4.5.0 | |
with: | |
java-version: '21' | |
distribution: 'corretto' | |
cache: 'gradle' | |
- name: Extract API Version | |
run: echo "API_VERSION=$(grep 'api.version=' gradle.properties | cut -d '=' -f2)" >> $GITHUB_ENV | |
- name: Build API | |
run: ./gradlew :api:build | |
- name: Upload API | |
run: gh release upload v${{ env.VERSION }} api/build/libs/api-${{ env.API_VERSION }}.jar --clobber | |
build: | |
needs: create-release | |
runs-on: ${{ matrix.os }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
VERSION: ${{ needs.create-release.outputs.version }} | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4.5.0 | |
with: | |
java-version: '21' | |
distribution: 'corretto' | |
cache: 'gradle' | |
- name: Build ${{ matrix.os }} | |
run: ./gradlew packageReleaseDistributionForCurrentOS | |
- name: Upload Windows Artifact | |
if: matrix.os == 'windows-latest' | |
run: gh release upload v${{ env.VERSION }} build/compose/binaries/main-release/msi/TextExplorer-${{ env.VERSION }}.msi --clobber | |
- name: Upload Linux Artifact | |
if: matrix.os == 'ubuntu-latest' | |
run: gh release upload v${{ env.VERSION }} build/compose/binaries/main-release/deb/textexplorer_${{ env.VERSION }}_amd64.deb --clobber | |
- name: Upload macOS Artifact | |
if: matrix.os == 'macos-latest' | |
run: gh release upload v${{ env.VERSION }} build/compose/binaries/main-release/dmg/TextExplorer-${{ env.VERSION }}.Dmg --clobber |