Update intellij-plugin-branch.yml #8
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 Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: IntelliJ Plugin Branch Release | |
on: | |
push: | |
tags: '*' | |
branches: '*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Set up Git Config | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Build with Maven | |
run: | | |
cd shared | |
mvn install | |
cd ../cli | |
mvn install | |
- name: Grant execute permission for gradlew | |
run: | | |
cd jdeploy-intellij-plugin | |
chmod +x ./gradlew | |
- name: Build Plugin | |
run: | | |
cd jdeploy-intellij-plugin | |
./gradlew buildPlugin | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: plugin | |
path: | | |
jdeploy-intellij-plugin/build/distributions/*.zip | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/pull/') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: plugin | |
- name: List plugin contents | |
run: ls -la ./plugin | |
shell: bash | |
- name: Get the version | |
id: get_version | |
run: | | |
echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/*/})" | |
shell: bash | |
- name: Delete Existing Release if Present | |
run: | | |
if gh release view jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }}; then | |
gh release delete jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }} | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }} | |
release_name: jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./plugin/jdeploy-intellij-plugin.zip | |
asset_name: jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }}.zip | |
asset_content_type: application/zip |