Files
DcsMissionScriptingTools/.github/workflows/publish-vs-code-extensions.yml
T
dutchie031 67c1c197b0
publish-vs-code-extensions.yml / Publish VS Code Extension (push) Failing after 43s
updated package versions
2026-09-09 16:51:41 +02:00

81 lines
2.5 KiB
YAML

on:
push:
branches:
- main
jobs:
publish:
name: Publish VS Code Extension
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from package.json
id: version
run: |
VERSION=$(jq -r '.version' dutchies-dcs-scripting-tools/package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Check if tag exists
id: tag_check
run: |
if git show-ref --verify --quiet "refs/tags/v${{ steps.version.outputs.version }}"; then
echo "tag_exists=true" >> $GITHUB_OUTPUT
echo "Tag v${{ steps.version.outputs.version }} already exists"
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
echo "Tag v${{ steps.version.outputs.version }} does not exist"
fi
- name: Exit if tag exists
if: steps.tag_check.outputs.tag_exists == 'true'
run: |
echo "Tag already exists, exiting."
exit 1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
cd dutchies-dcs-scripting-tools
npm install
- name: Build extension
run: |
cd dutchies-dcs-scripting-tools
npm run compile
- name: Package extension
if: steps.tag_check.outputs.tag_exists == 'false'
run: |
cd dutchies-dcs-scripting-tools
npx @vscode/vsce package
- name: Create tag and release
if: steps.tag_check.outputs.tag_exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
- name: Upload release assets
if: steps.tag_check.outputs.tag_exists == 'false'
uses: akkuman/gitea-release-action@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
body: "VS Code Extension Release"
draft: false
files: |-
dutchies-dcs-scripting-tools/dutchies-dcs-scripting-tools-*.vsix
env:
NODE_OPTIONS: '--experimental-fetch'