Skip to content

Commit 405a4f5

Browse files
author
Dilan Bhalla
committed
working for first version, updating to autoincrementing logic
1 parent c8077a5 commit 405a4f5

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

.github/workflows/microsoft-codeql-pack-publish.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Microsoft CodeQL Pack Publish
22
description: Fetches the latest version of CodeQL
33

4-
on:
5-
push:
6-
branches:
7-
- dilan/publish-opensource-packs
4+
# on:
5+
# push:
6+
# branches:
7+
# - dilan/publish-opensource-packs
88

99
jobs:
1010
codeqlversion:
@@ -45,29 +45,27 @@ jobs:
4545
- name: Publish OS Microsoft CodeQL Pack
4646
shell: bash
4747
run: |
48-
# # Download latest qlpack
49-
# gh codeql pack download "microsoft/$LANGUAGE-queries"
50-
# PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE"
51-
# VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l)
52-
# [[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; }
48+
# Download latest qlpack
49+
gh codeql pack download "microsoft/$LANGUAGE-queries"
50+
PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE"
51+
VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l)
52+
[[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; }
5353
54-
# # Increment version
55-
# CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1)
56-
# MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
57-
# MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
58-
# PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
59-
# NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
54+
# Increment version
55+
CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1)
56+
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
57+
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
58+
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
59+
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
6060
6161
# Extract dependencies from the existing qlpack.yml before deleting
6262
DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/src/qlpack.yml" 2>/dev/null)
6363
rm -f "$LANGUAGE/ql/src/qlpack.yml" "$LANGUAGE/ql/src/qlpack.lock"
6464
65-
FIRST_VERSION="0.0.1"
66-
6765
# Create new qlpack.yml with modified content
6866
cat <<EOF > "$LANGUAGE/ql/src/qlpack.yml"
6967
name: microsoft/$LANGUAGE-queries
70-
version: $FIRST_VERSION
68+
version: $NEXT_VERSION
7169
extractor: $LANGUAGE
7270
groups:
7371
- $LANGUAGE

0 commit comments

Comments
 (0)