sorting-files #2

Merged
abhishekbhakat merged 2 commits from sorting-files into main 2025-03-27 07:10:17 +00:00
Showing only changes of commit 4b38333d23 - Show all commits

View File

@@ -0,0 +1,84 @@
name: Release VSCode Extension
run-name: ${{ gitea.actor }} is releasing a new version 🚀
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
# Step 3: Install jq for JSON parsing
- name: Install jq
run: sudo apt-get install -y jq
# Step 4: Install project dependencies inside prompter directory
- name: Install dependencies
run: npm install
# Step 5: Install vsce globally
- name: Install vsce globally
run: npm install -g vsce
# Step 6: Install additional dev dependencies for building inside prompter directory
- name: Install build tools
run: npm install --save-dev webpack webpack-cli ts-loader
# Step 7: Build the extension inside prompter directory
- name: Build the extension
run: npm run webpack:prod
# Step 8: Package the extension into a VSIX file inside prompter directory
- name: Package the extension
run: vsce package
# Step 9: Extract the tag name from gitea.ref
- name: Extract tag name
run: |
TAG_NAME=$(echo "${{ gitea.ref }}" | sed 's/refs\/tags\///')
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
# Step 10: Determine the VSIX file name from package.json inside prompter directory
- name: Get VSIX file name
run: |
NAME=$(jq -r .name package.json)
VERSION=$(jq -r .version package.json)
VSIX_FILE="${NAME}-${VERSION}.vsix"
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_ENV
# Step 11: Create a new release in Gitea
- name: Create release
run: |
curl -X POST \
-H "Authorization: token ${{ gitea.token }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"Release $TAG_NAME\", \"body\": \"Automated release for version $TAG_NAME\"}" \
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases
# Step 12: Retrieve the release ID
- name: Get release ID
run: |
RELEASE_ID=$(curl -s -H "Authorization: token ${{ gitea.token }}" \
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases/tags/$TAG_NAME | jq .id)
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
# Step 13: Upload the VSIX file as a release asset (from prompter directory)
- name: Upload VSIX to release
run: |
curl -X POST \
-H "Authorization: token ${{ gitea.token }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"prompter/$VSIX_FILE" \
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases/$RELEASE_ID/assets?name=$VSIX_FILE