ci: fix generate docs #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: | |
# - Remove Old Draft Releases | |
# - Create New Draft Release | |
# The workflow is triggered on push to the main branch | |
# | |
# GitHub Actions reference: https://help.github.com/en/actions | |
# | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish_snapshot: | |
name: Publish Snapshot | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
# Set up Java environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Publish Snapshot | |
run: | | |
chmod +x ./publish_snapshot.sh | |
./publish_snapshot.sh ${{secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME}} ${{secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD}} | |
update_draft_release: | |
name: Create or Update Draft Release | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
# Set up Java environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
# Set environment variables | |
- name: Export Properties | |
id: properties | |
shell: bash | |
run: | | |
PROPERTIES="$(./gradlew properties --console=plain -q)" | |
VERSION="$(echo "$PROPERTIES" | grep "^VERSION_NAME:" | cut -f2- -d ' ')" | |
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
# Remove old release drafts by using the curl request for the available releases with a draft flag | |
- name: Remove Old Release Drafts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api repos/{owner}/{repo}/releases \ | |
--jq '.[] | select(.draft == true) | .id' \ | |
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} | |
# Create a new release draft which is not publicly visible and requires manual acceptance | |
- name: Create Release Draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${{ steps.properties.outputs.version }} \ | |
--draft \ | |
--title "v${{ steps.properties.outputs.version }}" \ | |
--notes "$(echo "${{ steps.properties.outputs.changelog }}")"git |