Merge pull request #137 from advanced-security/GeekMasher-patch-1 #124
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 and Publish Extractor Pack | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
queries: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
packs: ["lib", "src"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Check and Publish CodeQL Packs" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PACK_PATH=ql/${{ matrix.packs }}/qlpack.yml | |
CURRENT_VERSION=$(grep version $PACK_PATH | awk '{print $2}') | |
PACK_FULLNAME=$(cat $PACK_PATH | grep "name:" | awk '{print $2}') | |
PACK_NAME=$(echo $PACK_FULLNAME | awk -F '/' '{print $2}') | |
PUBLISHED_VERSION=$(gh api /orgs/advanced-security/packages/container/$PACK_NAME/versions --jq '.[0].metadata.container.tags[0]') | |
echo "Packs :: ${CURRENT_VERSION} -> ${PUBLISHED_VERSION}" | |
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then | |
gh extension install github/gh-codeql | |
gh codeql pack install "ql/${{ matrix.packs }}" | |
gh codeql pack publish "ql/${{ matrix.packs }}" | |
fi | |
compile: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Publish Extractor Pack" | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
./scripts/publish-extractor-pack.sh |