Skip to content

build: update extension to use node 20 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Check extension

on:
pull_request:
branches:
- main

permissions:
contents: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Install tfx-cli and typescript
run: |
npm install -g tfx-cli
npm install -g typescript

- name: Login to Azure DevOps
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_APPLICATION_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Get Azure DevOps access token
id: devops_token
run: |
TOKEN="$(az account get-access-token --resource "${{ secrets.AZURE_MARKETPLACE_ACCESS_SCOPE }}" --query accessToken -o tsv)"
echo "::add-mask::$TOKEN"
echo "azure_devops_access_token=$TOKEN" >> "$GITHUB_OUTPUT"

- name: Build release
run: |
make build

- name: Increment version
id: bump
run: |
chmod +x ./bump_version.sh
NEW_VERSION="$(./bump_version.sh)"
if [[ -z "$NEW_VERSION" ]]; then
echo "Version bump script returned empty version" >&2
exit 1
fi
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
48 changes: 35 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ permissions:
contents: write
id-token: write

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -20,48 +24,66 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '20'

- name: Install tfx-cli and typescript
run: |
npm install -g tfx-cli
npm install -g typescript

- name: Login to Azure DevOps
uses: azure/login@v1
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_APPLICATION_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Get Azure DevOps access token
id: get_token
id: devops_token
run: |
echo "AZURE_DEVOPS_ACCESS_TOKEN=$(az account get-access-token --resource ${{ secrets.AZURE_MARKETPLACE_ACCESS_SCOPE }} --query accessToken -o tsv)" >> $GITHUB_ENV
TOKEN="$(az account get-access-token --resource "${{ secrets.AZURE_MARKETPLACE_ACCESS_SCOPE }}" --query accessToken -o tsv)"
echo "::add-mask::$TOKEN"
echo "azure_devops_access_token=$TOKEN" >> "$GITHUB_OUTPUT"

- name: Build release
run: |
make build

- name: Increment version
id: bump
run: |
chmod +x ./bump_version.sh
NEW_VERSION=$(./bump_version.sh)
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
NEW_VERSION="$(./bump_version.sh)"
if [[ -z "$NEW_VERSION" ]]; then
echo "Version bump script returned empty version" >&2
exit 1
fi
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"

- name: Publish release
env:
AZURE_DEVOPS_ACCESS_TOKEN: ${{ env.AZURE_DEVOPS_ACCESS_TOKEN }}
AZURE_DEVOPS_ACCESS_TOKEN: ${{ steps.devops_token.outputs.azure_devops_access_token }}
run: |
make publish-release

- name: Commit version increment
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ./sysdig-cli-scan-task/task.json
git add ./VERSION
git add ./vss-extension.json
git commit -m "Increment version to ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
git push origin HEAD --tags

git add ./sysdig-cli-scan-task/task.json ./VERSION ./vss-extension.json
if git diff --cached --quiet; then
echo "No changes to commit."
exit 0
fi

VERSION="${{ steps.bump.outputs.new_version }}"
git commit -m "chore: bump version to ${VERSION}"
if git tag -l "${VERSION}" | grep -q "^${VERSION}$"; then
echo "Tag ${VERSION} already exists, skipping tag creation."
else
git tag -a "${VERSION}" -m "Release ${VERSION}"
fi

git push origin HEAD
git push origin "${VERSION}"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ AZURE_DEVOPS_ACCESS_TOKEN ?=
all: build

build:
npm install
cd $(TYPESCRIPT_SOURCE) && npm install && tsc
npm ci
cd $(TYPESCRIPT_SOURCE) && npm ci && tsc

publish-local: build
tfx extension publish \
Expand Down
15 changes: 9 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading