Skip to content

Commit c76cf66

Browse files
author
Alvaro Muñoz
committed
Add publish workflow
1 parent 65994db commit c76cf66

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.github/workflows/publish.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: "Create and publish the CodeQL Packs to the registry"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
10+
queries:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
language: ["java"]
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: "Check and publish LANG-queries (src) pack"
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
PUBLISHED_VERSION=$(gh api /orgs/githubsecuritylab/packages/container/${{ matrix.language }}-queries/versions --jq '.[0].metadata.container.tags[0]')
30+
CURRENT_VERSION=$(grep version ${{ matrix.language }}/src/qlpack.yml | awk '{print $2}')
31+
32+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
33+
gh extension install github/gh-codeql
34+
gh codeql pack install "${{ matrix.language }}/src"
35+
gh codeql pack publish "${{ matrix.language }}/src"
36+
fi
37+
38+
library:
39+
runs-on: ubuntu-latest
40+
41+
permissions:
42+
contents: read
43+
packages: write
44+
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
language: ["java"]
49+
50+
steps:
51+
- uses: actions/checkout@v3
52+
53+
- name: "Check and publish LANG-lib (lib) pack"
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
PUBLISHED_VERSION=$(gh api /orgs/githubsecuritylab/packages/container/${{ matrix.language }}-lib/versions --jq '.[0].metadata.container.tags[0]')
58+
CURRENT_VERSION=$(grep version ${{ matrix.language }}/lib/qlpack.yml | awk '{print $2}')
59+
60+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
61+
gh extension install github/gh-codeql
62+
gh codeql pack install "${{ matrix.language }}/lib"
63+
gh codeql pack publish "${{ matrix.language }}/lib"
64+
fi
65+
66+
extensions:
67+
runs-on: ubuntu-latest
68+
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
language: ["java"]
73+
74+
steps:
75+
- uses: actions/checkout@v3
76+
77+
- name: Check and publish LANG-extensions (ext) pack
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
run: |
81+
PUBLISHED_VERSION=$(gh api /orgs/githubsecuritylab/packages/container/${{ matrix.language }}-extensions/versions --jq '.[0].metadata.container.tags[0]')
82+
CURRENT_VERSION=$(grep version ${{ matrix.language }}/ext/qlpack.yml | awk '{print $2}')
83+
84+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
85+
gh extension install github/gh-codeql
86+
gh codeql pack install "${{ matrix.language }}/ext"
87+
gh codeql pack publish "${{ matrix.language }}/ext"
88+
fi
89+
90+
library_sources_extensions:
91+
runs-on: ubuntu-latest
92+
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
language: ["java"]
97+
98+
steps:
99+
- uses: actions/checkout@v3
100+
101+
- name: Check and publish LANG-library_sources_extensions (ext_library_sources) pack
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
run: |
105+
PUBLISHED_VERSION=$(gh api /orgs/githubsecuritylab/packages/container/${{ matrix.language }}-library_sources_extensions/versions --jq '.[0].metadata.container.tags[0]')
106+
CURRENT_VERSION=$(grep version ${{ matrix.language }}/ext_library_sources/qlpack.yml | awk '{print $2}')
107+
108+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
109+
gh extension install github/gh-codeql
110+
gh codeql pack install "${{ matrix.language }}/ext_library_sources"
111+
gh codeql pack publish "${{ matrix.language }}/ext_library_sources"
112+
fi

0 commit comments

Comments
 (0)