Skip to content

Commit 7d9f386

Browse files
Add version checking before lang pack publish, as dry run (#11)
1 parent fc8222c commit 7d9f386

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,32 @@ jobs:
6464
steps:
6565
- uses: actions/checkout@v4
6666

67-
#- name: Check qtil-LANGUAGE (src) pack
68-
# id: check_version
69-
# env:
70-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71-
# run: |
72-
# PUBLISHED_VERSION=$(gh api /orgs/advanced-security/packages/container/qtil-${{ matrix.language }}/versions --jq '.[0].metadata.container.tags[0]')
73-
# CURRENT_VERSION=$(grep version ${{ matrix.language }}/src/qlpack.yml | awk '{print $2}')
74-
# echo "Published version: $PUBLISHED_VERSION"
75-
# echo "Local version: $CURRENT_VERSION"
76-
# if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
77-
# echo "publish=true" >> $GITHUB_OUTPUT
78-
# fi
67+
- name: Check qtil-LANGUAGE (src) pack
68+
id: check_version
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
PUBLISHED_VERSION=$(gh api /orgs/advanced-security/packages/container/qtil-${{ matrix.language }}/versions --jq '.[0].metadata.container.tags[0]')
73+
CURRENT_VERSION=$(grep version ${{ matrix.language }}/src/qlpack.yml | awk '{print $2}')
74+
echo "Published version: $PUBLISHED_VERSION"
75+
echo "Local version: $CURRENT_VERSION"
76+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
77+
echo "publish=true" >> $GITHUB_OUTPUT
78+
else
79+
echo "publish=false" >> $GITHUB_OUTPUT
80+
fi
81+
- name: Log skipped publishing
82+
if: steps.check_version.outputs.publish == 'false'
83+
run: echo "Publishing is skipped as the local version matches the published version."
7984
- name: Setup CodeQL
80-
# if: steps.check_version.outputs.publish == 'true'
85+
if: steps.check_version.outputs.publish == 'true'
8186
uses: ./.github/actions/install-codeql
8287

8388
- name: Publish qtil-LANGUAGE (src) pack
84-
# if: steps.check_version.outputs.publish == 'true'
89+
if: steps.check_version.outputs.publish == 'true'
8590
env:
8691
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8792
run: |
8893
echo "Publishing pack 'qtil-${{ matrix.language }}'."
8994
codeql pack install "${{ matrix.language }}/src"
90-
codeql pack publish "${{ matrix.language }}/src"
95+
codeql pack publish --dry-run "${{ matrix.language }}/src"

0 commit comments

Comments
 (0)