forked from amazon-ion/ion-intellij-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (97 loc) · 3.16 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# 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 into master.
#
# Additional Docs:
# - GitHub Actions: https://help.github.com/en/actions
name: build-master
on:
push:
paths-ignore:
- '*.md'
branches:
- master
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@v2
# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
# Build and test plugin and provide artifact.
build:
name: Build
needs: gradleValidation
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
# Cache Gradle dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
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
- name: Get Product Versions
id: get-products
run: |
PRODUCTS="$(./gradlew printProductsReleases -q | jq -cnR '[inputs | select(length > 0)]')"
echo "products=$PRODUCTS"
echo "products=$PRODUCTS" >> "$GITHUB_OUTPUT"
outputs:
products: ${{ steps.get-products.outputs.products }}
verify:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
product: ${{ fromJSON(needs.build.outputs.products) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
# Run intellij:verifyPlugin task.
- name: Verify Plugin
run: ./gradlew verifyPlugin -PverifyPlugin="${{ matrix.product }}"
publish-beta:
needs: verify
runs-on: ubuntu-latest
if: github.repository == 'amazon-ion/ion-intellij-plugin'
steps:
# Publish plugin to beta channel
- name: Publish Beta Plugin
env:
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_TOKEN }}
PUBLISH_CHANNEL: beta
run: ./gradlew --stacktrace publishPlugin
# Upload plugin artifact to make it available in the next jobs
- name: Upload artifact
if: github.repository == 'amazon-ion/ion-intellij-plugin'
uses: actions/upload-artifact@v4
with:
name: plugin-artifact
path: ./build/distributions/