Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github Workflow for release automation
Browse files Browse the repository at this point in the history
MrLightful committed Sep 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent dca5e8f commit 415e97e
Showing 3 changed files with 53 additions and 24 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shadncn-tree-view",
"version": "0.0.1",
"version": "1.0.1",
"description": "",
"main": "index.js",
"scripts": {
23 changes: 0 additions & 23 deletions schema.json

This file was deleted.

0 comments on commit 415e97e

Please sign in to comment.