Merge pull request #29 from cognitivegears/cognitivegears/issue14 #8
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: OAShield CLI Build | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| # contents: write is required by the Create Release step on tag pushes | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven | |
| run: mvn -B package -P build-cli-jar -Dskip.http.calls=true | |
| - name: Upload CLI JAR | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: oashield-cli-jar | |
| path: target/oashield-cli.jar | |
| - name: Test CLI functionality | |
| run: | | |
| mkdir -p samples/output-test | |
| java -cp target/oashield-cli.jar org.openapitools.codegen.OpenAPIGenerator generate -g modsecurity3 -i samples/petstore.yaml -o samples/output-test | |
| if [ ! -f samples/output-test/mainconfig.conf ]; then | |
| echo "Failed to generate ModSecurity rules" | |
| exit 1 | |
| fi | |
| # Create release when a new tag is pushed | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| files: | | |
| target/oashield-cli.jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |