workflows improvements (#2963)

dev
Sandeep Singh 2022-12-05 18:22:55 +05:30 committed by GitHub
parent 2874a9dff7
commit 5c8e715fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 8 deletions

View File

@ -2,6 +2,8 @@ name: 🔨 Build Test
on: on:
pull_request: pull_request:
paths:
- '**.go'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -11,6 +13,7 @@ jobs:
matrix: matrix:
go-version: [1.18.x, 1.19.x] go-version: [1.18.x, 1.19.x]
os: [ubuntu-latest, windows-latest, macOS-12] os: [ubuntu-latest, windows-latest, macOS-12]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Set up Go - name: Set up Go
@ -21,8 +24,10 @@ jobs:
- name: Check out code - name: Check out code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Download modules - name: Go Mod hygine
run: go clean -modcache; go mod download run: |
go clean -modcache
go mod tidy
working-directory: v2/ working-directory: v2/
- name: Build - name: Build

View File

@ -17,7 +17,7 @@ jobs:
- name: Get Github tag - name: Get Github tag
id: meta id: meta
run: | run: |
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/nuclei/releases/latest" | jq -r .tag_name)" curl --silent "https://api.github.com/repos/projectdiscovery/nuclei/releases/latest" | jq -r .tag_name | xargs -I {} echo TAG={} >> $GITHUB_OUTPUT
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
@ -37,4 +37,4 @@ jobs:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: projectdiscovery/nuclei:latest,projectdiscovery/nuclei:${{ steps.meta.outputs.tag }} tags: projectdiscovery/nuclei:latest,projectdiscovery/nuclei:${{ steps.meta.outputs.TAG }}

View File

@ -2,6 +2,8 @@ name: 🧪 Functional Test
on: on:
pull_request: pull_request:
paths:
- '**.go'
workflow_dispatch: workflow_dispatch:

View File

@ -2,6 +2,8 @@ name: ⏰ Publish Docs
on: on:
pull_request: pull_request:
paths:
- '**.go'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -30,11 +32,11 @@ jobs:
go generate pkg/templates/templates.go go generate pkg/templates/templates.go
go build -o "cmd/docgen/docgen" cmd/docgen/docgen.go go build -o "cmd/docgen/docgen" cmd/docgen/docgen.go
./cmd/docgen/docgen ../SYNTAX-REFERENCE.md ../nuclei-jsonschema.json ./cmd/docgen/docgen ../SYNTAX-REFERENCE.md ../nuclei-jsonschema.json
echo "::set-output name=changes::$(git status -s | wc -l)" git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
working-directory: v2 working-directory: v2
- name: Commit files - name: Commit files
if: steps.generate-docs.outputs.changes > 0 if: steps.generate-docs.outputs.CHANGES > 0
run: | run: |
git config --local user.email "action@github.com" git config --local user.email "action@github.com"
git config --local user.name "GitHub Action" git config --local user.name "GitHub Action"
@ -42,7 +44,7 @@ jobs:
git commit -m "Auto Generate Syntax Docs + JSONSchema [$(date)] :robot:" -a git commit -m "Auto Generate Syntax Docs + JSONSchema [$(date)] :robot:" -a
- name: Push changes - name: Push changes
if: steps.generate-docs.outputs.changes > 0 if: steps.generate-docs.outputs.CHANGES > 0
uses: ad-m/github-push-action@master uses: ad-m/github-push-action@master
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -2,7 +2,8 @@ name: 👮🏼‍♂️ Sonarcloud
on: on:
pull_request: pull_request:
types: [opened, synchronize, reopened] paths:
- '**.go'
workflow_dispatch: workflow_dispatch:
jobs: jobs:

View File

@ -2,6 +2,8 @@ name: 🛠 Template Validate
on: on:
pull_request: pull_request:
paths:
- '**.go'
workflow_dispatch: workflow_dispatch:
jobs: jobs: