chore: Various updates #7
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
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
name: Publish tool definitions | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.setup.outputs.matrix }} | |
steps: | |
- name: Setup | |
id: setup | |
env: | |
CONFIG: >- | |
[ | |
{ | |
"tool_name": "fod-uploader", | |
"tool_repo": "fod-dev/fod-uploader-java", | |
"regex": ".*/FoDUpload.jar" | |
}, | |
{ | |
"tool_name": "fcli", | |
"tool_repo": "fortify/fcli", | |
"regex": "v.*/(fcli-linux.tgz|fcli-mac.tgz|fcli-windows.zip)" | |
} | |
] | |
run: echo "matrix=$(jq -r -c . <<< "$CONFIG")" >> $GITHUB_OUTPUT | |
- name: Check | |
run: jq . <<< '${{ steps.setup.outputs.matrix }}' | |
generate-tool-definitions: | |
needs: setup | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.setup.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check | |
env: | |
MATRIX: ${{ toJSON(matrix) }} | |
TOOL_NAME: ${{ fromJSON(toJSON(matrix)).tool_name }} | |
TOOL_REPO: ${{ fromJSON(toJSON(matrix)).tool_repo }} | |
REGEX: ${{ fromJSON(toJSON(matrix)).regex }} | |
run: | | |
echo "MATRIX: $(jq -r -c '.' <<< "$MATRIX")" | |
echo "TOOL_NAME: [$TOOL_NAME]" | |
echo "TOOL_REPO: [$TOOL_REPO]" | |
echo "REGEX: [$REGEX]" | |
- name: Generate tool definitions | |
uses: ./internal/generator | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tool_name: ${{ fromJSON(toJSON(matrix)).tool_name }} | |
tool_repo: ${{ fromJSON(toJSON(matrix)).tool_repo }} | |
regex: ${{ fromJSON(toJSON(matrix)).regex }} | |
sign_key: ${{ secrets.SIGN_KEY }} | |
sign_passphrase: ${{ secrets.SIGN_PASSPHRASE }} | |
- name: Configure git | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@fortify.com | |
- name: Commit updates | |
run: | | |
git add . && git commit -m "chore: Update ${{ fromJSON(toJSON(matrix)).tool_name }} cache & resources" \ | |
&& git push || \ | |
echo "No update needed or update failed" | |