test 1 #189
Workflow file for this run
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
# SPDX-FileCopyrightText: 2022 2023 RTE FRANCE | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Continuous Deployment - JavaDocs | |
on: | |
pull_request_target: | |
types: [ labeled, closed ] | |
jobs: | |
build: | |
if: ${{ github.event.pull_request.base.ref == 'develop' && github.actor != 'dependabot[bot]' && github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'javadoc') }} | |
name: Java Docs | |
runs-on: ubuntu-latest | |
env: | |
DEPLOYMENT_BRANCH: gh-pages | |
DEPENDABOT_BRANCH: dependabot/javadoc-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.number }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
- name: Create custom Maven Settings.xml | |
uses: whelk-io/maven-settings-xml-action@v21 | |
with: | |
output_file: custom_maven_settings.xml | |
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' | |
- name: Configure Git | |
run: | | |
git config --global user.name '${{ secrets.CONFIG_CI_USER_NAME }}' | |
git config --global user.email '${{ secrets.CONFIG_CI_USER_EMAIL }}' | |
git config pull.rebase false | |
git fetch origin ${{ env.DEPLOYMENT_BRANCH }} | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_BOT}} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
# Take note that your GitHub Pages site is currently being built from the /docs folder in the DEPLOYMENT_BRANCH branch. | |
- name: Prepare Pull Request branch & commit files | |
run: | | |
mvn -s custom_maven_settings.xml clean javadoc:aggregate -P javadoc | |
mkdir -p docs/javadoc | |
yes | cp -Rf target/site/apidocs/* docs/javadoc/ | |
git checkout -b temp | |
git add docs/javadoc/ | |
git commit -m "[dependabot/javadoc/temp]: update javadoc" | |
git checkout ${{ env.DEPLOYMENT_BRANCH }} | |
git clean -fdx | |
git checkout -b ${{ env.DEPENDABOT_BRANCH }} | |
git cherry-pick -n -X theirs temp | |
git commit -m "[dependabot/javadoc]: update javadoc" | |
git checkout ${{ env.DEPLOYMENT_BRANCH }} | |
git merge ${{ env.DEPENDABOT_BRANCH }} | |
- name: Push Git Branch | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ env.DEPLOYMENT_BRANCH }} |