-
Notifications
You must be signed in to change notification settings - Fork 22
108 lines (94 loc) · 3.27 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
# 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
strategy:
fail-fast: false
matrix:
product: [ "IC-2022.2", "IC-2023.1"]
max-parallel: 5
env:
PRODUCT_NAME: ${{ matrix.product }}
outputs:
name: ${{ steps.properties.outputs.name }}
version: ${{ steps.properties.outputs.version }}
artifact: ${{ steps.properties.outputs.artifact }}
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') }}
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')"
ARTIFACT="${NAME}-${VERSION}.zip"
echo "::set-output name=version::$VERSION"
echo "::set-output name=name::$NAME"
echo "::set-output name=artifact::$ARTIFACT"
# Build artifact using buildPlugin Gradle task
- name: Build Plugin
run: ./gradlew buildPlugin
# Run intellij:verifyPlugin task.
- name: Verify Plugin
run: ./gradlew verifyPlugin
# Publish plugin to beta channel
- name: Publish Beta Plugin
if: github.repository == 'amzn/ion-intellij-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 == 'amzn/ion-intellij-plugin'
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.product }}-plugin-artifact
path: ./build/distributions/${{ needs.build.outputs.artifact }}