From a5e6a9c65847dcbae83e5c6b2e8acbce83c35818 Mon Sep 17 00:00:00 2001 From: dutchie031 Date: Wed, 9 Sep 2026 16:27:00 +0200 Subject: [PATCH] Created CD pipeline --- .../workflows/publish-vs-code-extensions.yml | 70 ++++++++++++++++++- dutchies-dcs-scripting-tools/package.json | 2 +- 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-vs-code-extensions.yml b/.github/workflows/publish-vs-code-extensions.yml index 451cfa8..79da4e2 100644 --- a/.github/workflows/publish-vs-code-extensions.yml +++ b/.github/workflows/publish-vs-code-extensions.yml @@ -2,7 +2,7 @@ on: push: branches: - main - + jobs: publish: name: Publish VS Code Extension @@ -10,3 +10,71 @@ jobs: 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: '18' + + - 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 vsce package -o ../dutchies-dcs-scripting-tools.vsix + + - 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.vsix + env: + NODE_OPTIONS: '--experimental-fetch' diff --git a/dutchies-dcs-scripting-tools/package.json b/dutchies-dcs-scripting-tools/package.json index a3a0ebf..ba21c36 100644 --- a/dutchies-dcs-scripting-tools/package.json +++ b/dutchies-dcs-scripting-tools/package.json @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/dutchie031/DcsMissionScriptingTools" + "url": "https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools" }, "categories": [ "Other"