Skip to content

Build and Release

Build and Release #167

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
branches:
- main
# schedule: TODO: align release schedule with CLI
# - cron: '0 9 * * 2' # every Tuesday at 9 am UTC
jobs:
build:
uses: snyk/vscode-extension/.github/workflows/ci.yaml@main
publish:
runs-on: ubuntu-latest
needs: build
environment: Stable
name: Publish extension
outputs:
new-version: ${{ steps.patched-tag.outputs.new_version }}
new-tag: ${{ steps.patched-tag.outputs.new_tag }}
steps:
- name: Fetch sources
uses: actions/checkout@v2
- name: Setup VSCE
run: sudo npm install -g vsce@latest
- name: Install dependencies
run: npm ci
- name: Bump patch version
id: patched-tag
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: main,fix.*,chore.*
default_bump: patch
- name: Add Credentials
run: |
sed -i \
-e 's|${env.SNYK_VSCE_AMPLITUDE_EXPERIMENT_API_KEY}|${{ secrets.SNYK_VSCE_AMPLITUDE_EXPERIMENT_API_KEY }}|g' \
-e 's|${env.SNYK_VSCE_SENTRY_DSN_KEY}|${{ secrets.SNYK_VSCE_SENTRY_DSN_KEY }}|g' \
snyk.config.json
- name: Publish to Marketplace
run: vsce publish -p ${{ secrets.MARKETPLACE_TOKEN }} --no-update-package-json ${{ steps.patched-tag.outputs.new_version }}
release:
runs-on: ubuntu-latest
needs: publish
environment: Stable
name: Release
steps:
- name: Fetch sources
uses: actions/checkout@v2
- name: Setup VSCE
run: sudo npm install -g vsce@latest
- name: Install dependencies
run: npm ci
- name: Package VSIX
run: |
run: |
sed -i \
-e 's|${env.SNYK_VSCE_AMPLITUDE_EXPERIMENT_API_KEY}|${{ secrets.SNYK_VSCE_AMPLITUDE_EXPERIMENT_API_KEY }}|g' \
-e 's|${env.SNYK_VSCE_SENTRY_DSN_KEY}|${{ secrets.SNYK_VSCE_SENTRY_DSN_KEY }}|g' \
snyk.config.json
echo y | vsce package --no-git-tag-version --no-update-package-json ${{ needs.publish.outputs.new-version }}
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ needs.publish.outputs.new-tag }}
tag_name: ${{ needs.publish.outputs.new-tag }}
body: '${{ steps.extract-release-notes.outputs.release_notes }}'
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
**/*.vsix