Skip to content

Commit c0db226

Browse files
authored
[toolbox] Build in CI (#487)
The rest (publishing) is a todo.
1 parent dd50651 commit c0db226

File tree

2 files changed

+28
-115
lines changed

2 files changed

+28
-115
lines changed

.github/workflows/build.yml

+23-67
Original file line numberDiff line numberDiff line change
@@ -66,68 +66,22 @@ jobs:
6666
java-version: 17
6767
cache: gradle
6868

69-
# Set environment variables
70-
- name: Export Properties
71-
id: properties
72-
shell: bash
73-
run: |
74-
PROPERTIES="$(./gradlew properties --console=plain -q)"
75-
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
76-
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
77-
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
78-
CHANGELOG="${CHANGELOG//'%'/'%25'}"
79-
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
80-
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
81-
echo "::set-output name=version::$VERSION"
82-
echo "::set-output name=name::$NAME"
83-
echo "::set-output name=changelog::$CHANGELOG"
84-
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
85-
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
86-
8769
# Run plugin build
8870
- name: Run Build
89-
run: ./gradlew clean buildPlugin --info
90-
91-
# until https://github.com/JetBrains/gradle-intellij-plugin/issues/1027 is solved
92-
93-
# # Cache Plugin Verifier IDEs
94-
# - name: Setup Plugin Verifier IDEs Cache
95-
# uses: actions/cache@v2.1.7
96-
# with:
97-
# path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
98-
# key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
99-
#
100-
# # Run Verify Plugin task and IntelliJ Plugin Verifier tool
101-
# - name: Run Plugin Verification tasks
102-
# run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
103-
#
104-
# # Collect Plugin Verifier Result
105-
# - name: Collect Plugin Verifier Result
106-
# if: ${{ always() }}
107-
# uses: actions/upload-artifact@v4
108-
# with:
109-
# name: pluginVerifier-result
110-
# path: ${{ github.workspace }}/build/reports/pluginVerifier
71+
run: ./gradlew clean build --info
11172

11273
# Run Qodana inspections
11374
- name: Qodana - Code Inspection
11475
uses: JetBrains/qodana-action@v2023.3.2
11576

116-
# Prepare plugin archive content for creating artifact
117-
- name: Prepare Plugin Artifact
118-
id: artifact
119-
shell: bash
120-
run: |
121-
cd ${{ github.workspace }}/build/distributions
122-
FILENAME=`ls *.zip`
123-
unzip "$FILENAME" -d content
124-
echo "::set-output name=filename::${FILENAME:0:-4}"
12577
# Store already-built plugin as an artifact for downloading
126-
- name: Upload artifact
127-
uses: actions/upload-artifact@v4
128-
with:
129-
name: ${{ steps.artifact.outputs.filename }}
130-
path: ./build/distributions/content/*/*
78+
# TODO: Need a modified copyPlugin task or something like that to copy all
79+
# the required jar files.
80+
#- name: Upload artifact
81+
# uses: actions/upload-artifact@v4
82+
# with:
83+
# name: ${{ steps.artifact.outputs.filename }}
84+
# path: ./build/distributions/content/*/*
13185

13286
# Prepare a draft release for GitHub Releases page for the manual verification
13387
# If accepted and published, release workflow would be triggered
@@ -142,24 +96,26 @@ jobs:
14296
- name: Fetch Sources
14397
uses: actions/checkout@v4.1.7
14498

99+
# TODO: If we keep the two plugins in the same repository, we need a way
100+
# to differentiate the tags and releases.
145101
# Remove old release drafts by using the curl request for the available releases with draft flag
146102
- name: Remove Old Release Drafts
147103
env:
148104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149-
run: |
150-
gh api repos/{owner}/{repo}/releases \
151-
--jq '.[] | select(.draft == true) | .id' \
152-
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
105+
run: echo "Not implemented" ; exit 1 #|
106+
#gh api repos/{owner}/{repo}/releases \
107+
# --jq '.[] | select(.draft == true) | .id' \
108+
# | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
153109
# Create new release draft - which is not publicly visible and requires manual acceptance
154110
- name: Create Release Draft
155111
env:
156112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157-
run: |
158-
gh release create v${{ needs.build.outputs.version }} \
159-
--draft \
160-
--target ${GITHUB_REF_NAME} \
161-
--title "v${{ needs.build.outputs.version }}" \
162-
--notes "$(cat << 'EOM'
163-
${{ needs.build.outputs.changelog }}
164-
EOM
165-
)"
113+
run: echo "Not implemented" ; exit 1 #|
114+
#gh release create v${{ needs.build.outputs.version }} \
115+
# --draft \
116+
# --target ${GITHUB_REF_NAME} \
117+
# --title "v${{ needs.build.outputs.version }}" \
118+
# --notes "$(cat << 'EOM'
119+
#${{ needs.build.outputs.changelog }}
120+
#EOM
121+
#)"

.github/workflows/release.yml

+5-48
Original file line numberDiff line numberDiff line change
@@ -27,63 +27,20 @@ jobs:
2727
java-version: 17
2828
cache: gradle
2929

30-
# Set environment variables
31-
- name: Export Properties
32-
id: properties
33-
shell: bash
34-
run: |
35-
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
36-
${{ github.event.release.body }}
37-
EOM
38-
)"
39-
40-
CHANGELOG="${CHANGELOG//'%'/'%25'}"
41-
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
42-
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
43-
44-
echo "::set-output name=changelog::$CHANGELOG"
45-
46-
# Update Unreleased section with the current release note
47-
- name: Patch Changelog
48-
if: ${{ steps.properties.outputs.changelog != '' }}
49-
env:
50-
CHANGELOG: ${{ steps.properties.outputs.changelog }}
51-
run: |
52-
./gradlew patchChangelog --release-note="$CHANGELOG"
53-
5430
# Publish the plugin to the Marketplace
31+
# TODO@JB: Not sure if Toolbox will go to the same marketplace.
5532
- name: Publish Plugin
5633
env:
5734
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
5835
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
5936
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
6037
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
61-
run: ./gradlew publishPlugin --info
38+
run: echo "Not implemented" ; exit 1 #./gradlew publishPlugin --info
6239

6340
# Upload artifact as a release asset
41+
# TODO: Need a modified copyPlugin task or something like that to copy all
42+
# the required jar files.
6443
- name: Upload Release Asset
6544
env:
6645
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
68-
69-
# Create pull request
70-
- name: Create Pull Request
71-
if: ${{ steps.properties.outputs.changelog != '' }}
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
run: |
75-
VERSION="${{ github.event.release.tag_name }}"
76-
BRANCH="changelog-update-$VERSION"
77-
78-
git config user.email "action@github.com"
79-
git config user.name "GitHub Action"
80-
81-
git checkout -b $BRANCH
82-
git commit -am "Changelog update - $VERSION"
83-
git push --set-upstream origin $BRANCH
84-
85-
gh pr create \
86-
--title "Changelog update - \`$VERSION\`" \
87-
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
88-
--base main \
89-
--head $BRANCH
46+
run: echo "Not implemented" ; exit 1 #gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*

0 commit comments

Comments
 (0)