-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(archetype): add GitHub workflows and update .mvn
- Loading branch information
1 parent
5a52e55
commit da78aee
Showing
31 changed files
with
2,111 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
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
59 changes: 59 additions & 0 deletions
59
...es/scaffold-lite/src/main/resources/archetype-resources/.github/workflows/create-tags.yml
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,59 @@ | ||
# todo: git push 由于 credentials and gitconfig 问题, 暂时搁置该 workflow | ||
name: "[Tags] Create tag" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
prepare_tag: | ||
# Only proceed if the workflow dispatch event is for the "main" branch | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }} | ||
passphrase: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }} | ||
|
||
- name: Configure GPG for CI | ||
run: | | ||
mkdir -p ~/.gnupg | ||
chmod 700 ~/.gnupg | ||
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | ||
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf | ||
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | ||
- name: Test GPG signing | ||
run: | | ||
gpg -K | ||
echo "test gpg" > test.txt | ||
gpg -ab test.txt | ||
gpg --verify test.txt.asc | ||
rm test.txt test.txt.asc | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
server-id: central-portal | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
# resolve miss user.name and user.email gitconfig when push | ||
- name: Set up Git config | ||
run: | | ||
git config --global user.name "${{ secrets.GH_USER_NAME }}" | ||
git config --global user.email "${{ secrets.GH_USER_EMAIL }}" | ||
- name: Prepare release tag | ||
run: | | ||
./mvnw clean -Pcoding,auto-release release:prepare -B --settings .mvn/settings.xml |
68 changes: 68 additions & 0 deletions
68
...affold-lite/src/main/resources/archetype-resources/.github/workflows/trigger-releases.yml
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,68 @@ | ||
name: "[Release] Publish releases packages to Maven Central" | ||
|
||
on: | ||
release: | ||
types: [ created ] # triggers on release creation | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Validate tag version format | ||
run: | | ||
# Fail if the release tag doesn't match x.x or x.x.x | ||
if [[ ! "${{ github.event.release.tag_name }}" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then | ||
echo "::error ::Invalid version format '${{ github.event.release.tag_name }}'. Must match x.x or x.x.x." | ||
exit 1 | ||
fi | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }} | ||
passphrase: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }} | ||
|
||
- name: Configure GPG for CI | ||
run: | | ||
mkdir -p ~/.gnupg | ||
chmod 700 ~/.gnupg | ||
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | ||
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf | ||
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | ||
- name: Test GPG signing | ||
run: | | ||
gpg -K | ||
echo "test gpg" > test.txt | ||
gpg -ab test.txt | ||
gpg --verify test.txt.asc | ||
rm test.txt test.txt.asc | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
server-id: central-portal | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
- name: Set version | ||
run: | | ||
./mvnw versions:set -DnewVersion=${{ github.event.release.tag_name }} | ||
- name: Publish package | ||
run: | | ||
./mvnw --batch-mode clean deploy \ | ||
-Pcoding,publish-central -DskipTests --settings .mvn/settings.xml | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | ||
GPG_KEYID: ${{ secrets.GPG_KEYID }} |
64 changes: 64 additions & 0 deletions
64
...ffold-lite/src/main/resources/archetype-resources/.github/workflows/trigger-snapshots.yml
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,64 @@ | ||
name: "[Snapshots] Publish snapshots package to GitHub Packages" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '.github/**' | ||
- '.gitlab/**' | ||
- 'Writerside/**' | ||
- '.mvn/**' | ||
- '**/*.md' | ||
- '*.yml' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
# 当在 main 分支执行 ./mvnw release:prepare 时, 会产生两次 push 到 main, 避免触发重复 ci/cd(两次) | ||
# skip if commit message has [maven-release-plugin] prepare release | ||
if: "! contains(github.event.head_commit.message, '[maven-release-plugin] prepare release')" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }} | ||
passphrase: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }} | ||
|
||
- name: Configure GPG for CI | ||
run: | | ||
mkdir -p ~/.gnupg | ||
chmod 700 ~/.gnupg | ||
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | ||
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf | ||
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | ||
- name: Test GPG signing | ||
run: | | ||
gpg -K | ||
echo "test gpg" > test.txt | ||
gpg -ab test.txt | ||
gpg --verify test.txt.asc | ||
rm test.txt test.txt.asc | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
|
||
- name: Publish to GitHub Packages | ||
run: | | ||
./mvnw --batch-mode clean deploy \ | ||
-Pcoding,publish-github -DskipTests --settings .mvn/settings.xml | ||
env: | ||
GITHUB_USERNAME: ${{ secrets.GH_USERNAME}} | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
109 changes: 109 additions & 0 deletions
109
...rc/main/resources/archetype-resources/.github/workflows/trigger-writerside-docs-build.yml
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,109 @@ | ||
# see https://www.jetbrains.com/help/writerside/deploy-docs-to-github-pages.html | ||
name: "[Pages] Trigger Build Writerside documentation" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- feat/241230-0.7 | ||
paths: [ 'Writerside/*' ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
pages: write | ||
|
||
env: | ||
INSTANCE: 'Writerside/radp' | ||
DOCKER_VERSION: '243.22562' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
algolia_artifact: ${{ steps.define-ids.outputs.algolia_artifact }} | ||
artifact: ${{ steps.define-ids.outputs.artifact }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Define instance id and artifacts | ||
id: define-ids | ||
run: | | ||
INSTANCE=${INSTANCE#*/} | ||
INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]') | ||
ARTIFACT="webHelp${INSTANCE_ID_UPPER}2-all.zip" | ||
ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip" | ||
# Print the values | ||
echo "INSTANCE_ID_UPPER: $INSTANCE_ID_UPPER" | ||
echo "ARTIFACT: $ARTIFACT" | ||
echo "ALGOLIA_ARTIFACT: $ALGOLIA_ARTIFACT" | ||
# Set the environment variables and outputs | ||
echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV | ||
echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV | ||
echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV | ||
echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT | ||
echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT | ||
- name: Build docs using Writerside Docker builder | ||
uses: JetBrains/writerside-github-action@v4 | ||
with: | ||
instance: ${{ env.INSTANCE }} | ||
artifact: ${{ env.ARTIFACT }} | ||
docker-version: ${{ env.DOCKER_VERSION }} | ||
|
||
- name: Save artifact with build results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docs | ||
path: | | ||
artifacts/${{ env.ARTIFACT }} | ||
artifacts/report.json | ||
artifacts/${{ env.ALGOLIA_ARTIFACT }} | ||
retention-days: 7 | ||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docs | ||
path: artifacts | ||
|
||
- name: Test documentation | ||
uses: JetBrains/writerside-checker-action@v1 | ||
with: | ||
instance: ${{ env.INSTANCE }} | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: [build, test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docs | ||
path: artifacts | ||
|
||
- name: Unzip artifact | ||
run: unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.artifact }}" -d dir | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Package and upload Pages artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: dir | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
Oops, something went wrong.