Skip to content

Commit

Permalink
Rebasing workflow branch, re-run of test w fixed configs
Browse files Browse the repository at this point in the history
Move pluginVerifierIdeVersions to gradle.properties

Remove unneccessary draft construction logic in workflow

Add plugin verifier to build.gradle, fix properties location
  • Loading branch information
justint committed Mar 2, 2021
1 parent ed06e26 commit 0b3cda5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 70 deletions.
75 changes: 7 additions & 68 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
# - validate Gradle Wrapper,
# - run test and verifyPlugin tasks,
# - run buildPlugin task and prepare artifact for the further tests,
# - run IntelliJ Plugin Verifier,
# - create a draft release.
# - run IntelliJ Plugin Verifier
#
# Workflow is triggered on push and pull_request events.
#
# Docs:
# - GitHub Actions: https://help.github.com/en/actions
# - IntelliJ Plugin Verifier GitHub Action: https://github.com/ChrisCarini/intellij-platform-plugin-verifier-action
#
## JBIJPPTPL
##

name: Build
on: [push, pull_request]
Expand Down Expand Up @@ -42,7 +41,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

# Check out current repository
- name: Fetch Sources
Expand Down Expand Up @@ -79,15 +78,14 @@ jobs:
outputs:
name: ${{ steps.properties.outputs.name }}
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
artifact: ${{ steps.properties.outputs.artifact }}
steps:

# Setup Java 1.8 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

# Check out current repository
- name: Fetch Sources
Expand All @@ -114,16 +112,11 @@ jobs:
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)"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
NAME="$(echo "$PROPERTIES" | grep "^name:" | cut -f2- -d ' ')"
ARTIFACT="${NAME}-${VERSION}.zip"
echo "::set-output name=version::$VERSION"
echo "::set-output name=name::$NAME"
echo "::set-output name=changelog::$CHANGELOG"
echo "::set-output name=artifact::$ARTIFACT"
# Build artifact using buildPlugin Gradle task
Expand All @@ -149,7 +142,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

# Check out current repository
- name: Fetch Sources
Expand Down Expand Up @@ -189,58 +182,4 @@ jobs:

# Run IntelliJ Plugin Verifier action using GitHub Action
- name: Verify Plugin
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}

# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
releaseDraft:
name: Release Draft
if: github.event_name != 'pull_request'
needs: [build, verify]
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2

# Remove old release drafts by using the curl request for the available releases with draft flag
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
# Create new release draft - which is not publicly visible and requires manual acceptance
- name: Create Release Draft
id: createDraft
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.build.outputs.version }}
release_name: v${{ needs.build.outputs.version }}
body: ${{ needs.build.outputs.changelog }}
draft: true

# Download plugin artifact provided by the previous job
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: plugin-artifact

# Upload artifact as a release asset
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createDraft.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.artifact }}
asset_name: ${{ needs.build.outputs.artifact }}
asset_content_type: application/zip
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
plugins {
id 'org.jetbrains.intellij' version '0.4.8'
id 'org.jetbrains.intellij' version '0.7.2'
}

repositories {
mavenCentral()
maven { url "https://www.jetbrains.com/intellij-repository/releases" }
maven { url "https://www.jetbrains.com/intellij-repository/snapshots" }
}

group 'com.justint'
Expand All @@ -20,4 +26,8 @@ patchPluginXml {
changeNotes = htmlFixer('src/main/resources/META-INF/change-notes.html')
sinceBuild '192'
untilBuild '203.*'
}

runPluginVerifier {
ideVersions = "$pluginVerifierIdeVersions"
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pluginVerifierIdeVersions = 2019.2.4, 2020.2.4, 2020.3.2
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name = 'usd-idea'

0 comments on commit 0b3cda5

Please sign in to comment.