@anddone/adminportaltestautomation 1.1.0 → 1.2.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.
|
@@ -30,47 +30,66 @@ jobs:
|
|
|
30
30
|
registry-url: https://registry.npmjs.org/
|
|
31
31
|
|
|
32
32
|
# 3. Install dependencies
|
|
33
|
-
- run: npm
|
|
33
|
+
- run: npm install
|
|
34
34
|
|
|
35
35
|
# 4. Build project
|
|
36
36
|
- run: npm run build
|
|
37
37
|
|
|
38
|
-
# 5. Configure Git for
|
|
38
|
+
# 5. Configure Git for tags/commits
|
|
39
39
|
- name: Configure Git
|
|
40
40
|
run: |
|
|
41
41
|
git config user.name "github-actions[bot]"
|
|
42
42
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
43
43
|
|
|
44
|
-
# 6. Bump version
|
|
44
|
+
# 6. Bump version safely
|
|
45
45
|
- name: Bump version
|
|
46
46
|
run: |
|
|
47
|
-
|
|
47
|
+
RELEASE_TYPE=${{ inputs.release_type }}
|
|
48
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
49
|
+
NEW_VERSION=$(npm version $RELEASE_TYPE --no-git-tag-version)
|
|
50
|
+
echo "Current version: $CURRENT_VERSION"
|
|
51
|
+
echo "New version: $NEW_VERSION"
|
|
52
|
+
git add package.json
|
|
53
|
+
git commit -m "chore(release): $NEW_VERSION"
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
# Delete tag if exists
|
|
56
|
+
if git rev-parse "v$NEW_VERSION" >/dev/null 2>&1; then
|
|
57
|
+
git tag -d "v$NEW_VERSION"
|
|
58
|
+
git push origin :refs/tags/v$NEW_VERSION
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Create new tag
|
|
62
|
+
git tag "v$NEW_VERSION"
|
|
63
|
+
git push origin master --follow-tags
|
|
54
64
|
|
|
55
|
-
#
|
|
65
|
+
# 7. Publish to npm
|
|
56
66
|
- name: Publish to npm
|
|
57
67
|
run: npm publish --access public
|
|
58
68
|
env:
|
|
59
69
|
NODE_AUTH_TOKEN: ${{ secrets.TestAutomationAuth }}
|
|
60
70
|
|
|
61
|
-
#
|
|
71
|
+
# 8. Slack Success Notification
|
|
62
72
|
- name: Slack Success
|
|
63
73
|
if: success()
|
|
64
74
|
run: |
|
|
75
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
65
76
|
VERSION=$(node -p "require('./package.json').version")
|
|
77
|
+
# Read release notes from file (multiline supported)
|
|
78
|
+
if [ -f release-note.txt ]; then
|
|
79
|
+
RELEASE_NOTES=$(sed ':a;N;$!ba;s/\n/\\n• /g' release-note.txt)
|
|
80
|
+
RELEASE_NOTES="• $RELEASE_NOTES"
|
|
81
|
+
else
|
|
82
|
+
RELEASE_NOTES="• No release notes provided"
|
|
83
|
+
fi
|
|
84
|
+
|
|
66
85
|
curl -X POST -H 'Content-type: application/json' \
|
|
67
86
|
--data "{
|
|
68
|
-
\"username\": \"
|
|
69
|
-
\"text\": \":white_check_mark: npm package published!\n*Version:* $VERSION\n*Notes:*\n
|
|
87
|
+
\"username\": \"$PACKAGE_NAME\",
|
|
88
|
+
\"text\": \":white_check_mark: npm package published!\n*Package:* $PACKAGE_NAME\n*Version:* $VERSION\n*Notes:*\n$RELEASE_NOTES\"
|
|
70
89
|
}" \
|
|
71
90
|
${{ secrets.SLACK_WEBHOOK_URL }}
|
|
72
91
|
|
|
73
|
-
#
|
|
92
|
+
# 9. Slack Failure Notification
|
|
74
93
|
- name: Slack Failure
|
|
75
94
|
if: failure()
|
|
76
95
|
run: |
|