Skip to content

Add Github Workflow for release automation #8

Add Github Workflow for release automation

Add Github Workflow for release automation #8

Workflow file for this run

on:
push:
branches:
- main
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract package version
run: echo "PACKAGE_VERSION=$(npm pkg get version | sed 's/"//g')" >> "$GITHUB_ENV"
- name: Get release (if exists)
id: getRelease
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
doNotFailIfNotFound: true
releaseName: "v${{ env.PACKAGE_VERSION }}"
- name: Fail on duplicate release
run: |
if [ -n "${{ steps.getRelease.RELEASE_ID}}" ]; then
echo "Release already exists"
exit 1
fi
- name: Create schema.json
run: node scripts/create-schema.js
- name: Upload schema.json
uses: actions/upload-artifact@v4
with:
name: schema.json
path: schema.json
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: "v${{ env.PACKAGE_VERSION }}"
tag_name: "v${{ env.PACKAGE_VERSION }}"
files: schema.json
fail_on_unmatched_files: true
make_latest: true