Broaden Android Studio compatibility to Hedgehog (2023.1.1) and later #117
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.properties.outputs.version }} | |
| changelog: ${{ steps.properties.outputs.changelog }} | |
| artifact: ${{ steps.artifact.outputs.filename }} | |
| steps: | |
| - name: Fetch Sources | |
| uses: actions/checkout@v4 | |
| - name: Gradle Wrapper Validation | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| cache: gradle | |
| - name: Export Properties | |
| id: properties | |
| shell: bash | |
| run: | | |
| PROPERTIES="$(./gradlew properties --console=plain -q)" | |
| VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
| NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')" | |
| CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "name=$NAME" >> $GITHUB_OUTPUT | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Build Plugin | |
| run: ./gradlew buildPlugin | |
| - name: Prepare Plugin Artifact | |
| id: artifact | |
| shell: bash | |
| run: | | |
| cd ${{ github.workspace }}/build/distributions | |
| FILENAME=$(ls *.zip | head -1) | |
| unzip "$FILENAME" -d content | |
| echo "filename=${FILENAME%.zip}" >> $GITHUB_OUTPUT | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.artifact.outputs.filename }} | |
| path: ./build/distributions/content/*/* | |
| releaseDraft: | |
| name: Release Draft | |
| if: github.event_name != 'pull_request' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Fetch Sources | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| cache: gradle | |
| - name: Build Plugin (for zip attachment) | |
| run: ./gradlew buildPlugin | |
| - name: Remove Old Release Drafts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh api repos/{owner}/{repo}/releases \ | |
| --jq '.[] | select(.draft == true) | .id' \ | |
| | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} | |
| - name: Create Release Draft | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "v${{ needs.build.outputs.version }}" \ | |
| ./build/distributions/*.zip \ | |
| --draft \ | |
| --title "v${{ needs.build.outputs.version }}" \ | |
| --notes "${{ needs.build.outputs.changelog }}" |