Merge pull request #34 from DopplerHQ/release/2024-11-19 #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release: | |
environment: Production | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
registry-url: "https://registry.npmjs.org" | |
- name: Get Version | |
id: version | |
run: echo "version=v$(npm pkg get version | sed 's/"//g')" >> $GITHUB_OUTPUT; | |
- name: Check If Tag Exists | |
id: tag | |
run: echo "exists=$(gh release view "$TAG" &> /dev/null && echo "true" || echo "false")" >> $GITHUB_OUTPUT; | |
env: | |
TAG: ${{ steps.version.outputs.version }} | |
GH_TOKEN: ${{ github.token }} | |
- name: NPM Install | |
if: steps.tag.outputs.exists == 'false' | |
run: npm ci | |
- name: Build Extension | |
id: build_extension | |
if: steps.tag.outputs.exists == 'false' | |
run: npm run package && echo "extension_path=$(ls *.vsix)" >> $GITHUB_OUTPUT; | |
- name: Create release on GitHub | |
id: create_release | |
if: steps.tag.outputs.exists == 'false' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.version.outputs.version }} | |
release_name: ${{ steps.version.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload extension as release asset to GitHub | |
if: steps.tag.outputs.exists == 'false' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.build_extension.outputs.extension_path }} | |
asset_name: ${{ steps.build_extension.outputs.extension_path }} | |
asset_content_type: application/zip | |
- name: Publish to Marketplace | |
if: steps.tag.outputs.exists == 'false' | |
run: npm run publish | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- name: Publish to OVSX Marketplace | |
if: steps.tag.outputs.exists == 'false' | |
run: npm run publish-ovsx | |
env: | |
OVSX_PAT: ${{ secrets.OVSX_PAT }} |