push to releases on pr merge #3
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 and Release Plugin | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./gradlew | |
| - name: Build plugin | |
| run: ./gradlew buildPlugin | |
| - name: Get version from gradle.properties | |
| id: get_version | |
| run: | | |
| version=$(grep '^yampVersion=' gradle.properties | cut -d'=' -f2) | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Rename plugin artifact | |
| run: | | |
| mv plugin/build/distributions/*.zip plugin/build/distributions/yamp_plugin_${{ steps.get_version.outputs.version }}.zip | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| release_name: Release v${{ steps.get_version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload plugin artifact to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: plugin/build/distributions/yamp_plugin_${{ steps.get_version.outputs.version }}.zip | |
| asset_name: yamp_plugin_${{ steps.get_version.outputs.version }}.zip | |
| asset_content_type: application/zip |