Skip to content

Commit 62b4506

Browse files
committed
automatically update qlpacks with tag.
1 parent d45ba51 commit 62b4506

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ name: Publish CodeQL packs
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Pack version to publish (e.g. 0.3.1)"
10+
required: true
11+
type: string
612

713
permissions: {}
814

15+
env:
16+
REGISTRY: ghcr.io
17+
918
jobs:
1019
publish:
1120
runs-on: ubuntu-latest
@@ -21,7 +30,44 @@ jobs:
2130
version: '2.25.1'
2231
platform: 'linux64'
2332
checksum: '4f070e6cc7009e75aec307ed109c2fcf0501e579c20a31080b893e31209523d5'
33+
- name: Log in to the Container registry
34+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Resolve pack version
40+
run: |
41+
if [ -n "${{ inputs.version }}" ]; then
42+
echo "PACK_VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
43+
else
44+
TAG="${{ github.event.release.tag_name }}"
45+
echo "PACK_VERSION=${TAG#v}" >> "$GITHUB_ENV"
46+
fi
47+
- name: Set pack versions
48+
run: |
49+
for f in cpp/lib/qlpack.yml cpp/src/qlpack.yml go/src/qlpack.yml java/src/qlpack.yml; do
50+
sed -i "s/^version: .*/version: $PACK_VERSION/" "$f"
51+
done
2452
- run: make test
2553
- run: make publish
2654
env:
2755
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Generate manifest
57+
run: |
58+
cat > manifest.json <<EOF
59+
{
60+
"version": "$PACK_VERSION",
61+
"packs": [
62+
{"name": "trailofbits/cpp-all", "registry": "ghcr.io"},
63+
{"name": "trailofbits/cpp-queries", "registry": "ghcr.io"},
64+
{"name": "trailofbits/go-queries", "registry": "ghcr.io"},
65+
{"name": "trailofbits/java-queries", "registry": "ghcr.io"}
66+
]
67+
}
68+
EOF
69+
- name: Upload manifest
70+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
71+
with:
72+
name: publish-manifest
73+
path: manifest.json

0 commit comments

Comments
 (0)