Skip to content

Commit a05607b

Browse files
sbouchetadietish
authored andcommitted
chore: publish a nightly build
Signed-off-by: Stephane Bouchet <[email protected]>
1 parent cef6b30 commit a05607b

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/nightly.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Nightly Build
2+
on:
3+
schedule:
4+
- cron: '0 1 * * *'
5+
workflow_dispatch:
6+
7+
jobs:
8+
should-build-change:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
repo-cache-hit: ${{ steps.cache-last-commit.outputs.cache-hit }}
12+
steps:
13+
- name: Fetch Sources
14+
uses: actions/checkout@v4
15+
- run: |
16+
git rev-parse HEAD >> lastCommit
17+
- name: Check New Changes
18+
id: cache-last-commit
19+
uses: actions/cache@v4
20+
with:
21+
path: lastCommit
22+
key: lastCommit-${{ hashFiles('lastCommit') }}
23+
24+
# Prepare and publish the plugin to JetBrains Marketplace repository
25+
pre-release:
26+
needs: should-build-change
27+
if: ${{ needs.should-build-change.outputs.repo-cache-hit != 'true' || github.event_name != 'schedule' }}
28+
name: Publish Plugin
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: write
32+
pull-requests: write
33+
steps:
34+
# Check out current repository
35+
- name: Fetch Sources
36+
uses: actions/checkout@v4
37+
38+
# Set up Java environment for the next steps
39+
- name: Setup Java
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: 17
43+
distribution: 'temurin'
44+
cache: 'gradle'
45+
46+
# Setup Gradle
47+
- name: Setup Gradle
48+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
49+
with:
50+
add-job-summary: 'on-failure'
51+
add-job-summary-as-pr-comment: 'on-failure'
52+
validate-wrappers: true
53+
gradle-home-cache-cleanup: true
54+
55+
- name: Publish Plugin
56+
env:
57+
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}
58+
run: |
59+
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
60+
BASE_VERSION=${CURRENT_VERSION%-SNAPSHOT}
61+
TIMESTAMP=$(date +'%Y%m%d-%H%M%S')
62+
PLUGIN_VERSION="${BASE_VERSION}-${TIMESTAMP}"
63+
./gradlew publishPlugin -PjetBrainsToken=$PUBLISH_TOKEN -PprojectVersion=${PLUGIN_VERSION} -PjetBrainsChannel=nightly

0 commit comments

Comments
 (0)