-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from linwumingshi/feature/git-action
ci: 👷 add workflows for doc generation and version update
- Loading branch information
Showing
4 changed files
with
102 additions
and
3 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,61 @@ | ||
name: Run Plugin | ||
|
||
on: | ||
repository_dispatch: | ||
types: [run-plugin] | ||
|
||
jobs: | ||
use-artifact: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Example Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Build and Install Plugin | ||
run: mvn -DskipTests=true install | ||
|
||
|
||
- name: Set Artifact URL | ||
run: | | ||
ARTIFACT_ID="${{ github.event.client_payload.artifact_id }}" | ||
if [ -z "$ARTIFACT_ID" ]; then | ||
echo "Error: ARTIFACT_ID is not set." | ||
exit 1 | ||
fi | ||
ARTIFACT_URL="https://api.github.com/repos/TongchengOpenSource/smart-doc/actions/artifacts/${ARTIFACT_ID}/zip" | ||
echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_ENV | ||
- name: Download Artifact | ||
run: | | ||
echo "Downloading artifact from ${{ env.artifact_url }}" | ||
curl -L -o smart-doc-maven-jar.zip -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ env.artifact_url }}" | ||
- name: Create Directory and Move File | ||
run: | | ||
mkdir -p ~/.m2/repository/com/ly/smart-doc | ||
mv smart-doc-maven-jar.zip ~/.m2/repository/com/ly/smart-doc/ | ||
echo "Listing files in target directory:" | ||
ls -lh ~/.m2/repository/com/ly/smart-doc | ||
- name: Unzip Artifact | ||
run: | | ||
unzip -o -d ~/.m2/repository/com/ly/smart-doc ~/.m2/repository/com/ly/smart-doc/smart-doc-maven-jar.zip || (echo "Unzip failed" && exit 1) | ||
ls -lh ~/.m2/repository/com/ly/smart-doc | ||
- name: Build and Install Plugin Again | ||
run: mvn -DskipTests=true install | ||
|
||
|
||
- name: Generate doc | ||
run: mvn -DskipTests=true smart-doc:html | ||
|
||
|
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,36 @@ | ||
name: Update Plugin Version | ||
|
||
on: | ||
repository_dispatch: | ||
types: [update-plugin-version] | ||
|
||
jobs: | ||
update-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Example Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Update Smart-Doc Version in pom.xml | ||
run: | | ||
version=${{ github.event.client_payload.version }} | ||
mvn versions:set-property -Dproperty=smart-doc.version -DnewVersion=$version -DgenerateBackupPoms=false | ||
- name: Commit and Push Changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
git add pom.xml | ||
git commit -m "chore(pom.xml): :arrow_up: update smart-doc version to ${{ github.event.client_payload.version }}" | ||
git push origin master |
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