Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,6 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"

echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT

echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Generate Lexer and Parser
- name: Generate Lexer
run: ./gradlew generateLexer
Expand Down
52 changes: 1 addition & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,6 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
${{ github.event.release.body }}
EOM
)"

echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Update the Unreleased section with the current release note
- name: Patch Changelog
if: ${{ steps.properties.outputs.changelog != '' }}
env:
CHANGELOG: ${{ steps.properties.outputs.changelog }}
run: |
./gradlew patchChangelog --release-note="$CHANGELOG"

# Generate Lexer and Parser
- name: Generate Lexer
run: ./gradlew generateLexer
Expand All @@ -77,32 +55,4 @@ jobs:
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*

# Create a pull request
- name: Create Pull Request
if: ${{ steps.properties.outputs.changelog != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.event.release.tag_name }}"
BRANCH="changelog-update-$VERSION"
LABEL="release changelog"

git config user.email "[email protected]"
git config user.name "GitHub Action"

git checkout -b $BRANCH
git commit -am "Changelog update - $VERSION"
git push --set-upstream origin $BRANCH

gh label create "$LABEL" \
--description "Pull requests with release changelog update" \
--force \
|| true

gh pr create \
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
--label "$LABEL" \
--head $BRANCH
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
22 changes: 20 additions & 2 deletions .github/workflows/update_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,26 @@ concurrency:
cancel-in-progress: true

jobs:
update-changelog:
check-commit-message:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, 'Merge pull request')
outputs:
skip_job: ${{ steps.check.outputs.SKIP_JOB }}
steps:
- name: Check Commit Message
id: check
run: |
if [[ "${{ github.event.head_commit.message }}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${{ github.repository_owner }}/doc/changelog-update-.*$ ]]; then
echo "This commit is not target. Skip the workflow."
echo "SKIP_JOB=true" >> $GITHUB_OUTPUT
else
echo "SKIP_JOB=false" >> $GITHUB_OUTPUT
fi

update-changelog:
runs-on: ubuntu-latest
if: ${{ needs.check-commit-message.outputs.skip_job != 'true' }}
needs: [ check-commit-message ]
steps:

- name: Checkout repository
Expand All @@ -38,6 +55,7 @@ jobs:
uses: gradle/actions/setup-gradle@v4

- name: Run Gradle updateChangelog
id: updateChangelog
run: |
./gradlew updateChangelog -PreleaseDate=$(date +'%Y-%m-%d')
env:
Expand Down Expand Up @@ -76,4 +94,4 @@ jobs:
--label changelog,skip-changelog \
--head $BRANCH \
--draft
fi
fi
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ tasks.register("updateChangelog") {
val id: Long = 0,
val name: String = "",
val color: String = "",
val description: String = "",
val description: String? = "",
)

@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down Expand Up @@ -458,9 +458,10 @@ tasks.register("checkExistChangelogPullRequest") {
// https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests
val apiPath = "https://api.github.com/search/issues"
val status = "is:open"
val type = "type:pr"
val label = "label:changelog,skip-changelog"
val branch = "base:main+head:$newBranch"
val apiUrl = "$apiPath?q=repo:$repo+is:pr+$branch+$label+$status"
val apiUrl = "$apiPath?q=repo:$repo+$branch+$label+$status+$type"
val connection =
URL(apiUrl).openConnection().apply {
setRequestProperty("Authorization", "token $githubToken")
Expand Down
Loading