Adds build job for forked repos #37
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 Action Workflow for building a new commit to the primary repo branch and publishing a new release to beta. | |
# | |
# Workflow is triggered on pushes. Beta publish job runs conditionally if pushed to master. | |
# | |
# Additional Docs: | |
# - GitHub Actions: https://help.github.com/en/actions | |
name: build-master | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
jobs: | |
# Forks won't have codebuild runners set up, so they can't run the verifyPlugin commands | |
# Rather than have no CI for forks, we'll run the basic 'build' command | |
build-fork: | |
name: Build (fork) | |
if: github.repository != 'amazon-ion/ion-intellij-plugin' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- uses: gradle/actions/setup-gradle@v4 | |
# Build artifact using build Gradle task | |
- name: Build | |
run: ./gradlew build | |
build-source: | |
name: Build | |
if: github.repository == 'amazon-ion/ion-intellij-plugin' | |
runs-on: codebuild-ion-intellij-plugin-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- uses: gradle/actions/setup-gradle@v4 | |
# Build artifact using build Gradle task | |
- name: Build | |
run: ./gradlew build | |
# Build artifact using buildPlugin Gradle task | |
- name: Build Plugin | |
run: ./gradlew buildPlugin | |
# Run intellij:verifyPlugin task. | |
- name: Verify Plugin | |
run: ./gradlew verifyPlugin | |
publish-beta: | |
needs: build-source | |
if: github.repository == 'amazon-ion/ion-intellij-plugin' && github.ref == 'refs/heads/master' | |
runs-on: codebuild-ion-intellij-plugin-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- uses: gradle/actions/setup-gradle@v4 | |
# Publish plugin to beta channel | |
- name: Publish Beta Plugin | |
env: | |
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_TOKEN }} | |
PUBLISH_CHANNEL: beta | |
run: ./gradlew --stacktrace publishPlugin |