Skip to content

Commit

Permalink
Add Github Workflow for release automation
Browse files Browse the repository at this point in the history
  • Loading branch information
MrLightful committed Sep 13, 2024
1 parent dca5e8f commit a0439f7
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 24 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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.outputs.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": {
Expand Down
23 changes: 0 additions & 23 deletions schema.json

This file was deleted.

0 comments on commit a0439f7

Please sign in to comment.