Update release.yml #160
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 created for testing and preparing the plugin release in following steps: | |
# - validate Gradle Wrapper, | |
# - run test and verifyPlugin tasks, | |
# - run buildPlugin task and upload artifact | |
# | |
# Workflow is triggered on pull_request events. | |
# | |
# Docs: | |
# - GitHub Actions: https://help.github.com/en/actions | |
name: Build | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum | |
gradleValidation: | |
name: Gradle Wrapper | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Validate wrapper | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v2 | |
# Run verifyPlugin and test Gradle tasks | |
test: | |
name: Test | |
needs: gradleValidation | |
runs-on: ubuntu-latest | |
steps: | |
# Setup Java 17 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Cache Gradle dependencies | |
- name: Setup Gradle Dependencies Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} | |
# Cache Gradle Wrapper | |
- name: Setup Gradle Wrapper Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
# Run detekt, ktlint and tests | |
- name: Run Linters and Test | |
run: ./gradlew check | |
# Run verifyPlugin Gradle task | |
- name: Verify Plugin | |
run: ./gradlew verifyPlugin | |
# Build plugin with buildPlugin Gradle task and upload artifact | |
# Requires test job to be passed | |
build: | |
name: Build | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
# Setup Java 17 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 17 | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Cache Gradle Dependencies | |
- name: Setup Gradle Dependencies Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} | |
# Cache Gradle Wrapper | |
- name: Setup Gradle Wrapper Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
# Build artifact using buildPlugin Gradle task | |
- name: Build Plugin | |
run: ./gradlew buildPlugin | |
# Build unzip plugin to upload it as an artifact | |
- name: Unzip Plugin | |
run: unzip ./build/distributions/orion.zip -d unzipped | |
# Upload plugin artifact | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: orion | |
path: ./unzipped |