Skip to content

Commit

Permalink
Release pipeline fix
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Oct 2, 2024
1 parent 39da838 commit 559c1e9
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 94 deletions.
190 changes: 96 additions & 94 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,103 +12,105 @@ on:
workflow_dispatch:

jobs:
changelog-and-preparations:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:

- name: Checkout the plugin GitHub repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Fetch Gradle properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
PLUGIN_VERSION_FULL="$(echo "$PROPERTIES" | grep "^pluginVersion:" | cut -f2- -d ' ')"
CURR_COMMIT="$(git rev-parse HEAD)"
echo "pluginVersionSemVer: $PLUGIN_VERSION_FULL"
echo "currCommit: $CURR_COMMIT"
echo "pluginVersionSemVer=$PLUGIN_VERSION_FULL" >> $GITHUB_OUTPUT
echo "currCommit=$CURR_COMMIT" >> $GITHUB_OUTPUT
- name: Prepare changelog
shell: bash
run: ./gradlew patchChangelog

- name: Prepare release notes
id: release_notes
shell: bash
run: |
CHANGELOG="$(./gradlew getChangelog -q)"
echo 'version_release_notes<<EOF' >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
echo "Release notes to be added:"
echo "$CHANGELOG"
- name: Create new tag and release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag ${{ steps.properties.outputs.pluginVersionSemVer }}
git push origin ${{ steps.properties.outputs.pluginVersionSemVer }}
gh release create ${{ steps.properties.outputs.pluginVersionSemVer }} --title ${{ steps.properties.outputs.pluginVersionSemVer }} --target ${{ steps.properties.outputs.currCommit }} -F- <<EOF
${{ steps.release_notes.outputs.version_release_notes }}
EOF
# - name: Create Pull Request
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# VERSION="${{ steps.properties.outputs.pluginVersionSemVer }}"
# BRANCH="release-changelog-update-$VERSION"

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

# git checkout -b $BRANCH
# git commit -am ":moyai: ${VERSION}" -m "[skip ci]"
# git push --set-upstream origin $BRANCH

# gh pr create \
# --title ":moyai: \`$VERSION\`" \
# --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
# --base "release/v$VERSION" \
# --head $BRANCH

- name: Close Milestone
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/{owner}/{repo}/milestones \
--jq '.[] | select(.title == "${{ steps.properties.outputs.pluginVersionSemVer }}") | .number' \
| xargs -I '{}' gh api -X PATCH repos/{owner}/{repo}/milestones/{} -F state='closed'
# changelog-and-preparations:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# pull-requests: write
# steps:

# - name: Checkout the plugin GitHub repository
# uses: actions/checkout@v4

# - name: Validate Gradle Wrapper
# uses: gradle/wrapper-validation-action@v2

# - name: Setup Java
# uses: actions/setup-java@v4
# with:
# distribution: "zulu"
# java-version: 17

# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@v3
# with:
# gradle-home-cache-cleanup: true

# - name: Fetch Gradle properties
# id: properties
# shell: bash
# run: |
# PROPERTIES="$(./gradlew properties --console=plain -q)"
# PLUGIN_VERSION_FULL="$(echo "$PROPERTIES" | grep "^pluginVersion:" | cut -f2- -d ' ')"
# CURR_COMMIT="$(git rev-parse HEAD)"

# echo "pluginVersionSemVer: $PLUGIN_VERSION_FULL"
# echo "currCommit: $CURR_COMMIT"

# echo "pluginVersionSemVer=$PLUGIN_VERSION_FULL" >> $GITHUB_OUTPUT
# echo "currCommit=$CURR_COMMIT" >> $GITHUB_OUTPUT

# - name: Prepare changelog
# shell: bash
# run: ./gradlew patchChangelog

# - name: Prepare release notes
# id: release_notes
# shell: bash
# run: |
# CHANGELOG="$(./gradlew getChangelog -q)"

# echo 'version_release_notes<<EOF' >> $GITHUB_OUTPUT
# echo "$CHANGELOG" >> $GITHUB_OUTPUT
# echo 'EOF' >> $GITHUB_OUTPUT

# echo "Release notes to be added:"
# echo "$CHANGELOG"

# - name: Create new tag and release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# git tag ${{ steps.properties.outputs.pluginVersionSemVer }}
# git push origin ${{ steps.properties.outputs.pluginVersionSemVer }}
# gh release create ${{ steps.properties.outputs.pluginVersionSemVer }} --title ${{ steps.properties.outputs.pluginVersionSemVer }} --target ${{ steps.properties.outputs.currCommit }} -F- <<EOF
# ${{ steps.release_notes.outputs.version_release_notes }}
# EOF

# # - name: Create Pull Request
# # env:
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # run: |
# # VERSION="${{ steps.properties.outputs.pluginVersionSemVer }}"
# # BRANCH="release-changelog-update-$VERSION"

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

# # git checkout -b $BRANCH
# # git commit -am ":moyai: ${VERSION}" -m "[skip ci]"
# # git push --set-upstream origin $BRANCH

# # gh pr create \
# # --title ":moyai: \`$VERSION\`" \
# # --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
# # --base "release/v$VERSION" \
# # --head $BRANCH

# - name: Close Milestone
# continue-on-error: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh api repos/{owner}/{repo}/milestones \
# --jq '.[] | select(.title == "${{ steps.properties.outputs.pluginVersionSemVer }}") | .number' \
# | xargs -I '{}' gh api -X PATCH repos/{owner}/{repo}/milestones/{} -F state='closed'

release:
needs: [changelog-and-preparations]
# needs: [changelog-and-preparations]
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
product: ["IC-231","IC-233","IC-243"]
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ dependencies {
instrumentationTools()
pluginVerifier()
testFramework(TestFrameworkType.Plugin.Java)
zipSigner()
}
implementation(group = "com.squareup.retrofit2", name = "retrofit", version = retrofit2Vertion)
implementation("com.squareup.retrofit2:converter-gson:$retrofit2Vertion")
Expand Down

0 comments on commit 559c1e9

Please sign in to comment.