-
Notifications
You must be signed in to change notification settings - Fork 12
95 lines (82 loc) · 2.76 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (82 loc) · 2.76 KB
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
name: Build and Release Plugin
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build-artifact:
runs-on: ubuntu-latest
outputs:
plugin_version: ${{ steps.get_version.outputs.plugin_version }}
is_master: ${{ steps.check_branch.outputs.is_master }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.13'
cache-disabled: true
- name: Extract plugin version
id: get_version
run: |
version=$(grep '^pluginVersion=' gradle.properties | cut -d'=' -f2)
echo "$version" > plugin-version.txt
echo "plugin_version=$version" >> $GITHUB_OUTPUT
- name: Check if master branch
id: check_branch
run: |
if [ "${{ github.ref }}" == "refs/heads/master" ]; then
echo "is_master=true" >> $GITHUB_OUTPUT
else
echo "is_master=false" >> $GITHUB_OUTPUT
fi
- name: Build plugin
run: ./gradlew buildPlugin
- name: Rename plugin artifact
run: |
mv build/distributions/*.zip YALI_${{ steps.get_version.outputs.plugin_version }}.zip
- name: Upload plugin artifact
uses: actions/upload-artifact@v4
with:
name: YALI_${{ steps.get_version.outputs.plugin_version }}
path: YALI_${{ steps.get_version.outputs.plugin_version }}.zip
- name: Upload plugin version file
uses: actions/upload-artifact@v4
with:
name: plugin-version
path: plugin-version.txt
release:
if: needs.build-artifact.outputs.is_master == 'true'
needs: build-artifact
runs-on: ubuntu-latest
steps:
- name: Download plugin version file
uses: actions/download-artifact@v4
with:
name: plugin-version
- name: Read plugin version
id: read_version
run: |
version=$(cat plugin-version.txt)
echo "plugin_version=$version" >> $GITHUB_OUTPUT
- name: Download plugin artifact
uses: actions/download-artifact@v4
with:
name: YALI_${{ steps.read_version.outputs.plugin_version }}
- name: Create Release and Upload Artifact
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.read_version.outputs.plugin_version }}
name: Release v${{ steps.read_version.outputs.plugin_version }}
files: YALI_${{ steps.read_version.outputs.plugin_version }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}