apexgantt 3.10.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,17 +7,80 @@ on:
7
7
 
8
8
  permissions:
9
9
  id-token: write
10
- contents: read
10
+ contents: write
11
11
 
12
12
  jobs:
13
13
  publish:
14
14
  runs-on: ubuntu-latest
15
+ if: startsWith(github.event.head_commit.message, 'release:')
16
+
15
17
  steps:
16
18
  - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Check commit message and extract version
23
+ id: check
24
+ run: |
25
+ MSG="${{ github.event.head_commit.message }}"
26
+ if echo "$MSG" | grep -qE '^release: [0-9]+\.[0-9]+\.[0-9]+'; then
27
+ VERSION=$(echo "$MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+[^ ]*' | head -1)
28
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
29
+ if echo "$VERSION" | grep -qE '[-]'; then
30
+ echo "tag=next" >> $GITHUB_OUTPUT
31
+ else
32
+ echo "tag=latest" >> $GITHUB_OUTPUT
33
+ fi
34
+ else
35
+ echo "❌ Commit message must match 'release: X.Y.Z'"
36
+ exit 1
37
+ fi
38
+
39
+ - name: Verify package.json version matches commit message
40
+ run: |
41
+ PKG_VERSION=$(node -p "require('./package.json').version")
42
+ MSG_VERSION="${{ steps.check.outputs.version }}"
43
+ if [ "$PKG_VERSION" != "$MSG_VERSION" ]; then
44
+ echo "❌ package.json version ($PKG_VERSION) does not match commit message version ($MSG_VERSION)"
45
+ exit 1
46
+ fi
47
+ echo "✅ Version $PKG_VERSION confirmed"
48
+
17
49
  - uses: actions/setup-node@v4
18
50
  with:
19
51
  node-version: "20"
20
52
 
21
53
  - run: npm install -g npm@latest
22
54
  - run: npm install
23
- - run: npm publish --provenance
55
+
56
+ - name: Publish to npm
57
+ run: npm publish --provenance --tag ${{ steps.check.outputs.tag }}
58
+
59
+ - name: Create git tag
60
+ run: |
61
+ TAG="v${{ steps.check.outputs.version }}"
62
+ git config user.name "github-actions[bot]"
63
+ git config user.email "github-actions[bot]@users.noreply.github.com"
64
+ if git rev-parse "$TAG" >/dev/null 2>&1; then
65
+ echo "Tag $TAG already exists, skipping"
66
+ else
67
+ git tag -a "$TAG" -m "Release $TAG"
68
+ git push origin "$TAG"
69
+ fi
70
+
71
+ - name: Create GitHub Release
72
+ env:
73
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74
+ run: |
75
+ TAG="v${{ steps.check.outputs.version }}"
76
+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
77
+ if [ -n "$PREV_TAG" ]; then
78
+ NOTES=$(git log "$PREV_TAG..HEAD" --pretty=format:"- %s" --no-merges)
79
+ else
80
+ NOTES=$(git log --pretty=format:"- %s" --no-merges)
81
+ fi
82
+ if gh release view "$TAG" >/dev/null 2>&1; then
83
+ echo "Release $TAG already exists, skipping"
84
+ else
85
+ gh release create "$TAG" --notes "$NOTES" --title "$TAG"
86
+ fi