-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce prepare-release-headless.yml
- Loading branch information
Showing
1 changed file
with
123 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Quarkiverse Prepare Release | ||
|
||
on: | ||
workflow_call: | ||
# Map the workflow outputs to job outputs | ||
outputs: | ||
release-version: | ||
description: "Released Version" | ||
value: ${{ jobs.prepare-release.outputs.release-version }} | ||
next-version: | ||
description: "Next Version" | ||
value: ${{ jobs.prepare-release.outputs.next-version }} | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
prepare-release: | ||
runs-on: ubuntu-latest | ||
name: Prepare Release | ||
if: ${{github.event.pull_request.merged == true}} | ||
# Map the job outputs to step outputs | ||
outputs: | ||
release-version: ${{ steps.out.outputs.release-version }} | ||
next-version: ${{ steps.out.outputs.next-version }} | ||
|
||
steps: | ||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
name: Create GitHub App Token | ||
with: | ||
app-id: ${{ vars.CI_APP_ID }} | ||
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Get GitHub App User ID | ||
id: get-user-id | ||
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Configure Git author | ||
run: | | ||
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | ||
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' | ||
- uses: radcortez/project-metadata-action@main | ||
name: Retrieve project metadata | ||
id: metadata | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
metadata-file-path: '.github/project.yml' | ||
local-file: true | ||
|
||
- name: Set environment variables | ||
run: | | ||
echo "CURRENT_VERSION=${{steps.metadata.outputs.current-version}}" >> $GITHUB_ENV | ||
echo "NEXT_VERSION=${{steps.metadata.outputs.next-version}}" >> $GITHUB_ENV | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
cache: 'maven' | ||
|
||
- name: Detect Maven Wrapper | ||
run: | | ||
if [ -f mvnw ]; then | ||
echo "MAVEN_EXEC=./mvnw" >> $GITHUB_ENV | ||
else | ||
echo "MAVEN_EXEC=mvn" >> $GITHUB_ENV | ||
fi | ||
- name: Update latest release version in docs | ||
if: ${{ hashFiles('docs/pom.xml') != '' }} | ||
run: | | ||
$MAVEN_EXEC -B -ntp -pl docs -am package -DskipTests -DskipITs -Denforcer.skip -Dformatter.skip -Dimpsort.skip | ||
if ! git diff --quiet docs/modules/ROOT/pages/includes; then | ||
git add docs/modules/ROOT/pages/includes | ||
git commit -m "Update the latest release version ${{env.CURRENT_VERSION}} in documentation" | ||
fi | ||
- name: Bump .md files to ${{env.CURRENT_VERSION}} | ||
run: | | ||
find -name '*.md' -exec sed -i 's/${{env.NEXT_VERSION}}/${{env.CURRENT_VERSION}}/g' {} + | ||
find -name '*.md' -exec sed -i 's|raw.githubusercontent.com/${{ github.repository }}/main|raw.githubusercontent.com/${{ github.repository }}/${{env.CURRENT_VERSION}}|g' {} + | ||
if [[ `git status --porcelain` ]]; then | ||
git commit -a -m "Bump .md files to ${{env.CURRENT_VERSION}}" | ||
fi | ||
- name: Maven release ${{env.CURRENT_VERSION}} | ||
uses: coactions/setup-xvfb@v1 | ||
run: | | ||
$MAVEN_EXEC -B release:prepare -Prelease -Dgpg.skip=true -DreleaseVersion=${CURRENT_VERSION} -DdevelopmentVersion=${NEXT_VERSION} -Darguments="-Dgpg.skip=true" | ||
$MAVEN_EXEC -B release:clean | ||
- name: Bump .md files to ${{env.NEXT_VERSION}} | ||
run: | | ||
find -name '*.md' -exec sed -i 's|raw.githubusercontent.com/${{ github.repository }}/${{env.CURRENT_VERSION}}|raw.githubusercontent.com/${{ github.repository }}/main|g' {} + | ||
find -name '*.md' -exec sed -i 's/${{env.CURRENT_VERSION}}/${{env.NEXT_VERSION}}/g' {} + | ||
if [[ `git status --porcelain` ]]; then | ||
git commit -a -m "Bump .md files to ${{env.NEXT_VERSION}}" | ||
fi | ||
- name: Push changes to ${{github.base_ref}} branch and tag ${{env.CURRENT_VERSION}} | ||
run: | | ||
git push | ||
git push origin ${CURRENT_VERSION} | ||
- name: Output release version | ||
id: out | ||
run: | | ||
echo "release-version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | ||
echo "next-version=${NEXT_VERSION}" >> $GITHUB_OUTPUT | ||
- name: Create GitHub Release | ||
run: gh release create ${CURRENT_VERSION} --generate-notes | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} |