-
-
Notifications
You must be signed in to change notification settings - Fork 11
128 lines (112 loc) · 4.03 KB
/
release.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
name: Build, Release and Publish
# Creates an internal Release in GitHub, and on approval publishes to IntelliJ Marketplace
# Triggered by creating a "v1.2.3" tag on a release/ or main branch
# Version number is updated as per the tag
on:
push:
branches: [ "release/*", main ]
tags:
- "v*.*.*"
pull_request:
branches: [ release/* ]
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Update version number & changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
sed -i "s|^version = \".*-SNAPSHOT\"|version = \"${GITHUB_REF_NAME:1}\"|" build.gradle.kts
./gradlew patchChangelog
./gradlew getChangelog -q > CHANGELOG-release.md
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add build.gradle.kts
git commit -m "updated version"
- name: Push changes
uses: ad-m/github-push-action@master
if: startsWith(github.ref, 'refs/tags/')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true
# Needed until Vosk provide a new release to fix Windows issues - https://github.com/alphacep/vosk-api/releases 0.3.46?
- name: Checkout vosk-api
uses: actions/checkout@v3
with:
repository: alphacep/vosk-api
ref: fff40ce1a1f1b921272a184acfd0c21350750789
path: vosk-api
- name: Build & install Vosk with working native libraries
run: |
cd vosk-api/java/lib/src/main/resources
wget -q https://repo1.maven.org/maven2/com/alphacephei/vosk/0.3.38/vosk-0.3.38.jar
unzip -nq vosk-0.3.38.jar
rm -rf META-INF org
rm vosk-0.3.38.jar
cd ../../..
echo 'rootProject.name = "vosk"' > settings.gradle.kts
sed -i '10d;21,25d' build.gradle
sed -i '80s/^/\/\//' src/main/java/org/vosk/LibVosk.java
sed -i '218s/^/\/\//' src/main/java/org/vosk/Recognizer.java
gradle publishToMavenLocal
- name: Checkout jAdapterForNativeTTS
uses: actions/checkout@v3
with:
repository: jonelo/jAdapterForNativeTTS
path: jAdapterForNativeTTS
- name: Build jAdapterForNativeTTS
run: cd jAdapterForNativeTTS && mvn install
- name: Build
run: |
./gradlew buildPlugin
./gradlew verifyPlugin
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: distribution
path: './build/distributions/idiolect.zip'
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: CHANGELOG-release.md
generate_release_notes: true
files: |
CHANGELOG.md
build/distributions/*.zip
publish-to-marketplace:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build-and-release
# Requires approval - https://github.com/OpenASR/idiolect/settings/environments/788239124/edit
environment: Stable
env:
INTELLIJ_CHANNEL: Stable
INTELLIJ_PUBLISH_TOKEN: ${{ secrets.INTELLIJ_PUBLISH_TOKEN }}
INTELLIJ_CERTIFICATE_CHAIN: ${{ secrets.INTELLIJ_CERTIFICATE_CHAIN }}
INTELLIJ_PRIVATE_KEY: ${{ secrets.INTELLIJ_PRIVATE_KEY }}
INTELLIJ_PRIVATE_KEY_PASSWORD: ${{ secrets.INTELLIJ_PRIVATE_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v3
- name: Download artifact
uses: actions/[email protected]
with:
name: distribution
path: './build/distributions'
- name: Publish to Marketplace
run: |
./gradlew publishPlugin -x buildPlugin -x verifyPlugin
- name: Merge to master
if: github.ref != 'master'
uses: devmasx/merge-branch@master
with:
type: now
from_branch: github.ref
target_branch: master
github_token: ${{ github.token }}