Skip to content

Commit 94a1ed0

Browse files
committed
publish workflow
Signed-off-by: shalom <[email protected]>
1 parent e9c0017 commit 94a1ed0

File tree

2 files changed

+64
-46
lines changed

2 files changed

+64
-46
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
#
1111
# GitHub Actions reference: https://help.github.com/en/actions
1212
#
13-
## JBIJPPTPL
13+
## JBIJPPTPL (Jetbrains intellij platform plugin template)
1414

1515
name: Build
1616
on:
1717
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
1818
push:
19-
# branches: [main]
20-
# todo: temp, should be main
21-
branches: [ publish-workflow ]
19+
branches: [ main ]
2220
# Trigger the workflow on any pull request
23-
# pull_request:
24-
21+
pull_request:
22+
branches: [ main ]
2523

2624
jobs:
2725

26+
#todo: java matrix , os matrix
27+
2828
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
2929
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
3030
# Build plugin and provide the artifact for the next workflow jobs
@@ -34,6 +34,7 @@ jobs:
3434
outputs:
3535
version: ${{ steps.properties.outputs.version }}
3636
changelog: ${{ steps.properties.outputs.changelog }}
37+
3738
steps:
3839

3940
# Check out current repository
@@ -48,9 +49,13 @@ jobs:
4849
- name: Setup Java
4950
uses: actions/setup-java@v3
5051
with:
51-
distribution: zulu
52-
java-version: 11
53-
cache: gradle
52+
java-version: '11'
53+
distribution: 'corretto'
54+
55+
# All subsequent Gradle invocations will benefit from caching, build-scan capture and other features of the gradle-build-action.
56+
# setup-java can also cache gradle, but we use gradle-build-action for gradle caching and should not mix between workflows.
57+
- name: Setup Gradle
58+
uses: gradle/[email protected]
5459

5560
# Set environment variables
5661
- name: Export Properties
@@ -60,24 +65,27 @@ jobs:
6065
PROPERTIES="$(./gradlew properties --console=plain -q)"
6166
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
6267
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
63-
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
64-
CHANGELOG="${CHANGELOG//'%'/'%25'}"
65-
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
66-
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
67-
68+
69+
# the original template feeds the whole changelog history to the release draft. we don't need it,
70+
# and we don't keep a changelog file in the repository
71+
# CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
72+
# CHANGELOG="${CHANGELOG//'%'/'%25'}"
73+
# CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
74+
# CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
75+
6876
echo "::set-output name=version::$VERSION"
6977
echo "::set-output name=name::$NAME"
70-
echo "::set-output name=changelog::$CHANGELOG"
78+
# echo "::set-output name=changelog::$CHANGELOG"
7179
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
72-
80+
7381
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
7482
7583
# Run tests
7684
- name: Run Tests
7785
run: ./gradlew test
7886

7987
# Collect Tests Result of failed tests
80-
##todo: add more modules reports
88+
##todo: add other modules test reports
8189
- name: Collect Tests Result
8290
if: ${{ failure() }}
8391
uses: actions/upload-artifact@v3
@@ -94,7 +102,7 @@ jobs:
94102

95103
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
96104
- name: Run Plugin Verification tasks
97-
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
105+
run: ./gradlew buildPlugin runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
98106

99107
# Collect Plugin Verifier Result
100108
- name: Collect Plugin Verifier Result
@@ -157,7 +165,8 @@ jobs:
157165
gh release create v${{ needs.build.outputs.version }} \
158166
--draft \
159167
--title "v${{ needs.build.outputs.version }}" \
160-
--notes "$(cat << 'EOM'
161-
${{ needs.build.outputs.changelog }}
162-
EOM
163-
)"
168+
--notes "## $VERSION ATX_2 is reserved for patchChangelog"
169+
# --notes "$(cat << 'EOM'
170+
# ${{ needs.build.outputs.changelog }}
171+
# EOM
172+
# )"

.github/workflows/release.yml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ jobs:
2121
with:
2222
ref: ${{ github.event.release.tag_name }}
2323

24+
# Setup Java 11 environment for the next steps
2425
# Setup Java 11 environment for the next steps
2526
- name: Setup Java
2627
uses: actions/setup-java@v3
2728
with:
28-
distribution: zulu
29-
java-version: 11
30-
cache: gradle
29+
java-version: '11'
30+
distribution: 'corretto'
31+
32+
# All subsequent Gradle invocations will benefit from caching, build-scan capture and other features of the gradle-build-action.
33+
# setup-java can also cache gradle, but we use gradle-build-action for gradle caching and should not mix between workflows.
34+
- name: Setup Gradle
35+
uses: gradle/[email protected]
36+
3137

3238
# Set environment variables
3339
- name: Export Properties
@@ -42,15 +48,18 @@ jobs:
4248
CHANGELOG="${CHANGELOG//'%'/'%25'}"
4349
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
4450
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
45-
51+
CHANGELOG=$(echo $CHANGELOG | sed 's/## /### /g')
4652
echo "::set-output name=changelog::$CHANGELOG"
4753
4854
# Update Unreleased section with the current release note
55+
# we replaced ATX_2 with ATX_3 because patchChangelog will fail if it can't find ATX_2 line with a version.
56+
# we don't keep a changelog file in git, just create it here ,patch plugin.xml and ignore it.
4957
- name: Patch Changelog
5058
if: ${{ steps.properties.outputs.changelog != '' }}
5159
env:
5260
CHANGELOG: ${{ steps.properties.outputs.changelog }}
5361
run: |
62+
./gradlew initializeChangelog
5463
./gradlew patchChangelog --release-note="$CHANGELOG"
5564
5665
# Publish the plugin to the Marketplace
@@ -66,23 +75,23 @@ jobs:
6675
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
6776

6877
# Create pull request
69-
- name: Create Pull Request
70-
if: ${{ steps.properties.outputs.changelog != '' }}
71-
env:
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
run: |
74-
VERSION="${{ github.event.release.tag_name }}"
75-
BRANCH="changelog-update-$VERSION"
76-
77-
git config user.email "[email protected]"
78-
git config user.name "GitHub Action"
79-
80-
git checkout -b $BRANCH
81-
git commit -am "Changelog update - $VERSION"
82-
git push --set-upstream origin $BRANCH
83-
84-
gh pr create \
85-
--title "Changelog update - \`$VERSION\`" \
86-
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
87-
--base main \
88-
--head $BRANCH
78+
# - name: Create Pull Request
79+
# if: ${{ steps.properties.outputs.changelog != '' }}
80+
# env:
81+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
# run: |
83+
# VERSION="${{ github.event.release.tag_name }}"
84+
# BRANCH="changelog-update-$VERSION"
85+
#
86+
# git config user.email "[email protected]"
87+
# git config user.name "GitHub Action"
88+
#
89+
# git checkout -b $BRANCH
90+
# git commit -am "Changelog update - $VERSION"
91+
# git push --set-upstream origin $BRANCH
92+
#
93+
# gh pr create \
94+
# --title "Changelog update - \`$VERSION\`" \
95+
# --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
96+
# --base main \
97+
# --head $BRANCH

0 commit comments

Comments
 (0)