feat(plugin): 优化插件启动流程并增强白名单验证逻辑 #13
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: Build ConvenientAccess Plugin | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| java-version: [17, 21] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: 'temurin' | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Validate Maven project | |
| run: mvn validate | |
| - name: Compile project | |
| run: mvn compile | |
| - name: Run tests | |
| run: mvn test | |
| - name: Package plugin | |
| run: mvn package -DskipTests | |
| - name: Get project version | |
| id: project-version | |
| run: | | |
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Project version: $VERSION" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ConvenientAccess-${{ steps.project-version.outputs.version }}-java${{ matrix.java-version }} | |
| path: target/*.jar | |
| retention-days: 30 | |
| - name: Upload to release (on release) | |
| if: github.event_name == 'release' && matrix.java-version == '17' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: target/convenient-access-${{ steps.project-version.outputs.version }}.jar | |
| asset_name: ConvenientAccess-${{ steps.project-version.outputs.version }}.jar | |
| asset_content_type: application/java-archive | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Run code analysis | |
| run: | | |
| echo "Running code quality checks..." | |
| mvn compile | |
| - name: Check for security vulnerabilities | |
| run: | | |
| echo "Checking for security vulnerabilities..." | |
| mvn dependency:tree |