run-plugin #2
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
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 | |