build #213
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
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: | |
# - validate Gradle Wrapper, | |
# - run 'test' and 'verifyPlugin' tasks, | |
# - run Qodana inspections, | |
# - run 'buildPlugin' task and prepare artifact for the further tests, | |
# - run 'runPluginVerifier' task, | |
# - create a draft release. | |
# | |
# Workflow is triggered on push and pull_request events. | |
# | |
# GitHub Actions reference: https://help.github.com/en/actions | |
# | |
## JBIJPPTPL | |
name: Build | |
on: | |
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests) | |
#push: | |
# branches: [develop] | |
# Trigger the workflow on any pull request | |
pull_request: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [build] | |
jobs: | |
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum | |
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks | |
# Build plugin and provide the artifact for the next workflow jobs | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.properties.outputs.version }} | |
changelog: ${{ steps.properties.outputs.changelog }} | |
steps: | |
# Free GitHub Actions Environment Disk Space | |
- name: Maximize Build Space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
# Setup Java 11 environment for the next steps | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
cache: 'gradle' | |
# build edql repository | |
- name: Build library | |
id: edql-lib | |
shell: bash | |
run: | | |
./gradlew --info --no-daemon publishToMavenLocal | |
ls -al ~/.m2/repository/com/github/chengpohi | |
# Check out current repository | |
- name: Fetch plugin Sources | |
uses: actions/checkout@v3 | |
with: | |
repository: chengpohi/edql-idea-plugin | |
ref: develop | |
token: ${{ secrets.GH_PAT }} | |
path: 'idea-plugin' | |
- name: Build plugin | |
id: edql-plugin | |
shell: bash | |
run: | | |
cd idea-plugin && GH_ENV=CI ./gradlew --no-daemon buildPlugin | |
ls -lh build/distributions/* | |
cd .. | |
# Remove old release drafts by using the curl request for the available releases with a draft flag | |
- 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/{} | |
# Create a new release draft which is not publicly visible and requires manual acceptance | |
- name: Create Release Draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
run: | | |
cd ${{ github.workspace }}/idea-plugin | |
PROPERTIES="$(./gradlew properties --console=plain -q)" | |
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" | |
TAG="$(echo "v$VERSION")" | |
cd .. | |
gh release create $TAG \ | |
--draft \ | |
--title $TAG \ | |
--notes "$CHANGELOG" | |
gh release upload --clobber $TAG ./idea-plugin/build/distributions/* |