Update maven.yml #18
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Run Tests | |
run: mvn test | |
deploy: | |
name: Deploy with Ngrok | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Start Ngrok | |
run: | | |
curl -o ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip | |
unzip ngrok.zip | |
./ngrok http 8080 &>/dev/null & | |
- name: Wait for Ngrok to Initialize | |
run: sleep 5 | |
- name: Get Ngrok URL | |
id: ngrok | |
run: echo "::set-output name=url::$(curl -s http://localhost:8080/api/tunnels | jq -r '.tunnels[0].public_url')" | |
- name: Run SOOS DAST test | |
uses: soos-io/soos-dast-github-action@v2 | |
with: | |
client_id: i78cbw2bh | |
api_key: NTc1MDMzNjMtODU2Ni00MTE4LTkxODYtMTVlN2JkNWQwMjgy | |
project_name: "magazyn-server" | |
scan_mode: "baseline" | |
api_url: "https://api.soos.io/api/" | |
target_url: ${{ steps.ngrok.outputs.url }} |