forked from redhat-developer/lsp4ij
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (91 loc) · 3.21 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
name: Release Plugin
#Only one job at a time
concurrency: release
on:
workflow_dispatch:
inputs:
publishToMarketPlace:
description: 'Publish to JetBrains Marketplace ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'false'
jobs:
# Prepare and publish the plugin to JetBrains Marketplace repository
release:
if: ${{ inputs.publishToMarketPlace == 'true'}}
name: Publish to Marketplace
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set Release Version
id: release_version
shell: bash
run: |
PLUGIN_VERSION=$(./set_release_version.sh)
echo "Release version: $PLUGIN_VERSION"
echo "PLUGIN_VERSION=${PLUGIN_VERSION}" >> $GITHUB_ENV
# Publish the plugin to JetBrains Marketplace
- name: Publish Plugin to JetBrains Marketplace
env:
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}
run: |
./gradlew publishPlugin -PpluginVersion=$PLUGIN_VERSION -Pchannel=default
echo "Published $PLUGIN_VERSION to the Jetbrains Marketplace"
- name: Tag Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "action@github.com"
git config user.name "GitHub Action"
git commit -sam "chore(skip-release): set version to $PLUGIN_VERSION"
git tag $PLUGIN_VERSION
git push origin $PLUGIN_VERSION
# Set next SNAPSHOT version
- name: Increment Plugin Version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION=$(./increment_version.sh)
echo "Set $NEW_VERSION in gradle.properties"
git commit -sam "chore(skip-release): set version to $NEW_VERSION"
git push origin main
- name: Simple conventional changelog
uses: redhat-developer/simple-conventional-changelog@0a6db1ac3910c2cf66f2e1a530951dba1ece8540 #0.0.12
id: changelog
with:
token: ${{ secrets.GITHUB_TOKEN }}
current-tag: ${{env.PLUGIN_VERSION}}
types-mapping: 'feat:Features,fix:Bug Fixes,docs:Documentation,refactor:Refactoring,build:Build,chore:Other'
# Create a new Github release
- name: Create Github Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${PLUGIN_VERSION} \
--title "${PLUGIN_VERSION}" \
--notes "$(cat << 'EOM'
${{ steps.changelog.outputs.changelog }}
EOM
)"
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${PLUGIN_VERSION} ./build/distributions/*