CI #799
This file contains hidden or 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
| name: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '.github/**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: CI Build | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/[email protected] | |
| - name: Set up JDK 17 | |
| uses: actions/[email protected] | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| run: ./mvnw -DaltDeploymentRepository=local::file:deployment-repository --no-transfer-progress --batch-mode --update-snapshots deploy | |
| - name: Deploy to Artifactory | |
| if: ${{ github.repository == 'spring-projects/spring-shell' && github.ref_name == 'main' }} | |
| uses: spring-io/[email protected] | |
| with: | |
| uri: 'https://repo.spring.io' | |
| username: ${{ secrets.ARTIFACTORY_USERNAME }} | |
| password: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
| build-name: 'spring-shell-main' | |
| repository: 'libs-snapshot-local' | |
| folder: 'deployment-repository' | |
| signing-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| signing-passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Setup SSH key | |
| env: | |
| DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }} | |
| DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }} | |
| run: | | |
| mkdir "$HOME/.ssh" | |
| echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key" | |
| chmod 600 "$HOME/.ssh/key" | |
| echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts" | |
| - name: Capture project version | |
| run: echo PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV | |
| - name: Generate Java docs | |
| run: ./mvnw --no-transfer-progress javadoc:aggregate | |
| - name: Deploy Javadocs | |
| env: | |
| DOCS_HOST: ${{ secrets.DOCS_HOST }} | |
| DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }} | |
| DOCS_PATH: /opt/www/domains/spring.io/docs/htdocs/spring-shell | |
| run: | | |
| ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH/docs && mkdir -p $PROJECT_VERSION" | |
| scp -i $HOME/.ssh/key -r target/reports/apidocs $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/docs/$PROJECT_VERSION/api | |
| - name: Generate Reference docs | |
| working-directory: spring-shell-docs | |
| run: ../mvnw --no-transfer-progress resources:resources antora | |
| - name: Deploy Reference docs | |
| uses: spring-io/spring-doc-actions/[email protected] | |
| with: | |
| docs-username: ${{ secrets.DOCS_USERNAME }} | |
| docs-host: ${{ secrets.DOCS_HOST }} | |
| docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }} | |
| docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }} | |
| site-path: spring-shell-docs/target/site/shell | |
| - name: Bust Cloudflare Cache | |
| uses: spring-io/spring-doc-actions/[email protected] | |
| with: | |
| context-root: spring-shell | |
| cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
| cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} |