-
-
Notifications
You must be signed in to change notification settings - Fork 22
169 lines (143 loc) · 5.45 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Build
on: [push, pull_request]
jobs:
gradle-validation:
name: Gradle Wrapper
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v2
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
test:
name: Test
needs: gradle-validation
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Git Checkout
uses: actions/checkout@v2
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Run Tests
run: ./gradlew test
- name: Verify Plugin
run: ./gradlew verifyPlugin
build:
name: Build
needs: test
runs-on: ubuntu-latest
outputs:
name: ${{ steps.properties.outputs.name }}
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
pluginArchive: ${{ steps.properties.outputs.pluginArchive }}
steps:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Git Checkout
uses: actions/checkout@v2
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Set 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 ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
PLUGIN_ARCHIVE="${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=pluginArchive::$PLUGIN_ARCHIVE"
- name: Build Plugin
run: ./gradlew buildPlugin
- name: Upload Built Plugin Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.properties.outputs.pluginArchive }}
path: ./build/distributions/${{ steps.properties.outputs.pluginArchive }}
verify:
name: Verify
needs: build
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Git Checkout
uses: actions/checkout@v2
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Read Plugin Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)"
echo "::set-output name=ideVersions::$IDE_VERSIONS"
echo "::set-output name=verifierHome::~/.pluginVerifier"
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v2
with:
path: ${{ steps.properties.outputs.verifierHome }}/ides
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
- name: Verify Plugin
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.verifierHome }}
github-release:
name: Github Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build, verify]
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v2
- name: Download Plugin Artifact
id: download
uses: actions/download-artifact@v2
with:
name: ${{ needs.build.outputs.pluginArchive }}
- name: Publish Github Release
id: publish-release
uses: ncipollo/release-action@v1
with:
name: v${{ needs.build.outputs.version }}
body: ${{ needs.build.outputs.changelog }}
artifacts: ${{ steps.download.outputs.download-path }}${{ steps.properties.outputs.pluginArchive }}
artifactContentType: application/zip
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}