Skip to content

Simplify CI workflow by removing resolve-versions job and hardcoding … #3

Simplify CI workflow by removing resolve-versions job and hardcoding …

Simplify CI workflow by removing resolve-versions job and hardcoding … #3

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install frontend dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build backend
uses: magefile/mage-action@v3
with:
version: latest
args: buildAll
- name: Get plugin metadata
id: meta
run: |
PLUGIN_ID=$(jq -r '.id' dist/plugin.json)
PLUGIN_VERSION=$(jq -r '.info.version' dist/plugin.json)
echo "plugin-id=${PLUGIN_ID}" >> "$GITHUB_OUTPUT"
echo "plugin-version=${PLUGIN_VERSION}" >> "$GITHUB_OUTPUT"
echo "archive=${PLUGIN_ID}-${PLUGIN_VERSION}.zip" >> "$GITHUB_OUTPUT"
- name: Package plugin
run: |
cp LICENSE dist/
mv dist "${{ steps.meta.outputs.plugin-id }}"
zip -r "${{ steps.meta.outputs.archive }}" "${{ steps.meta.outputs.plugin-id }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.plugin-id }}-${{ steps.meta.outputs.plugin-version }}
path: ${{ steps.meta.outputs.archive }}
retention-days: 7
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${{ github.ref_name }}" > /dev/null 2>&1; then
gh release upload "${{ github.ref_name }}" \
"${{ steps.meta.outputs.archive }}" --clobber
else
gh release create "${{ github.ref_name }}" \
--title "${{ steps.meta.outputs.plugin-id }} v${{ steps.meta.outputs.plugin-version }}" \
--generate-notes \
"${{ steps.meta.outputs.archive }}"
fi