@hedia/types 2.1.38-alpha.0 → 2.1.39-alpha.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.
@@ -44,54 +44,12 @@ jobs:
44
44
  git config --global user.email "ci@hedia.co"
45
45
  git config --global user.name "Hedia CI Bot"
46
46
 
47
- - name: Amend [major] to Latest Commit
48
- if: "contains(github.event.pull_request.labels.*.name, 'Major')"
49
- run: |
50
- npm version premajor --preid alpha
51
-
52
- - name: Amend [minor] to Latest Commit
53
- if: "!contains(github.event.pull_request.labels.*.name, 'Major') && contains(github.event.pull_request.labels.*.name, 'Minor')"
54
- run: |
55
- npm version preminor --preid alpha
56
-
57
- - name: Amend [patch] to Latest Commit
58
- if: "!contains(github.event.pull_request.labels.*.name, 'Major') && !contains(github.event.pull_request.labels.*.name, 'Minor')"
59
- run: |
60
- npm version prepatch --preid alpha
61
-
62
- - name: Bump alpha version
63
- run: |
64
- chmod +x ./on-open-pr-bump-alpha-release.sh && ./on-open-pr-bump-alpha-release.sh
65
-
66
- - name: Publish alpha version
67
- id: publish-alpha
68
- uses: JS-DevTools/npm-publish@v1
69
- with:
70
- token: ${{ env.NPM_TOKEN }}
71
- tag: alpha
72
-
73
- - name: Check if version exists
74
- if: steps.publish-alpha.outputs.type == 'none'
75
- run: |
76
- echo "Package JSON version is already published, please bump the version!"
77
- exit 1
78
-
79
- - name: Remove alpha tag
80
- run: |
81
- chmod +x ./remove-alpha-tag.sh && ./remove-alpha-tag.sh
82
- git push
83
-
84
- - name: Remove old comment from PR
85
- uses: izhangzhihao/delete-comment@master
86
- with:
87
- github_token: ${{ secrets.GITHUB_TOKEN }}
88
- delete_user_name: github-actions[bot]
89
- issue_number: ${{ github.event.number }} # remove comments from the current PR
90
-
91
- - name: Write comment on PR
92
- uses: peter-evans/create-or-update-comment@v1
47
+ - name: Autobump & Publish
48
+ uses: hedia-team/autobump-and-publish@master
93
49
  with:
50
+ label: ${{ toJson(github.event.pull_request.labels.*.name) }}
51
+ npm-token: ${{ env.NPM_TOKEN }}
94
52
  issue-number: ${{ github.event.number }}
95
- body: |
96
- 🎉 Successfully released alpha version 🎉
97
- ✅ ${{ steps.publish-alpha.outputs.version }}
53
+ github-token: ${{ secrets.GITHUB_TOKEN }}
54
+ run-ci: true
55
+ run-tsc: true
@@ -25,31 +25,12 @@ jobs:
25
25
  with:
26
26
  node-version: ${{ matrix.node-version }}
27
27
 
28
- - name: Publish package
29
- id: publish-package
30
- uses: JS-DevTools/npm-publish@v1
31
- with:
32
- token: ${{ env.NPM_TOKEN }}
33
-
34
- - name: Check if version exists
35
- if: steps.publish-package.outputs.type == 'none'
36
- run: |
37
- echo "Package JSON version is already published, please bump the version!"
38
- exit 1
39
-
40
- - name: Remove old comment from PR
41
- if: steps.publish-package.outputs.type != 'none'
42
- uses: izhangzhihao/delete-comment@master
43
- with:
44
- github_token: ${{ secrets.GITHUB_TOKEN }}
45
- delete_user_name: github-actions[bot]
46
- issue_number: ${{ github.event.number }} # remove comments from the current PR
47
-
48
- - name: Write comment on PR
49
- if: steps.publish-package.outputs.type != 'none'
50
- uses: peter-evans/create-or-update-comment@v1
28
+ - name: Publish
29
+ uses: hedia-team/autobump-and-publish@master
51
30
  with:
31
+ npm-token: ${{ env.NPM_TOKEN }}
52
32
  issue-number: ${{ github.event.number }}
53
- body: |
54
- 🎉 Successfully released package 🎉
55
- ✅ ${{ steps.publish-package.outputs.version }}
33
+ github-token: ${{ secrets.GITHUB_TOKEN }}
34
+ is-post-merge: true
35
+ run-ci: true
36
+ run-tsc: true
@@ -13,11 +13,6 @@ jobs:
13
13
  on-push-commit-bump-and-publish-alpha:
14
14
  runs-on: ubuntu-latest
15
15
 
16
- outputs:
17
- type: ${{ steps.publish-alpha.outputs.type }}
18
- version: ${{ steps.publish-alpha.outputs.version }}
19
- skip: ${{ env.CI_SKIP }}
20
-
21
16
  strategy:
22
17
  matrix:
23
18
  node-version: [14.15]
@@ -44,56 +39,13 @@ jobs:
44
39
  git config --global user.email "ci@hedia.co"
45
40
  git config --global user.name "Hedia CI Bot"
46
41
 
47
- - name: Bump alpha version
48
- if: ${{ env.CI_SKIP == 'false' }}
49
- run: |
50
- chmod +x ./on-push-commit-bump-alpha.sh && ./on-push-commit-bump-alpha.sh
51
-
52
- - name: Publish alpha version
53
- if: ${{ env.CI_SKIP == 'false' }}
54
- id: publish-alpha
55
- uses: JS-DevTools/npm-publish@v1
56
- with:
57
- token: ${{ env.NPM_TOKEN }}
58
- tag: alpha
59
-
60
- - name: Check if version exists
61
- if: steps.publish-alpha.outputs.type == 'none'
62
- run: |
63
- echo "Package JSON version is already published, please bump the version!"
64
- exit 1
65
-
66
- - name: Remove alpha tag
42
+ - name: Autobump & Publish
67
43
  if: ${{ env.CI_SKIP == 'false' }}
68
- run: |
69
- chmod +x ./remove-alpha-tag.sh && ./remove-alpha-tag.sh
70
- git push
71
-
72
- after-publish:
73
- runs-on: ubuntu-latest
74
- needs: [on-push-commit-bump-and-publish-alpha]
75
- if: needs.on-push-commit-bump-and-publish-alpha.outputs.skip == 'false'
76
-
77
- strategy:
78
- matrix:
79
- node-version: [14.15]
80
-
81
- steps:
82
- - uses: actions/checkout@v2
83
- with:
84
- ref: ${{ github.event.pull_request.head.ref }}
85
-
86
- - name: Remove old comment from PR
87
- uses: izhangzhihao/delete-comment@master
88
- with:
89
- github_token: ${{ secrets.GITHUB_TOKEN }}
90
- delete_user_name: github-actions[bot]
91
- issue_number: ${{ github.event.number }} # remove comments from the current PR
92
-
93
- - name: Write comment on PR
94
- uses: peter-evans/create-or-update-comment@v1
44
+ uses: hedia-team/autobump-and-publish@master
95
45
  with:
46
+ label: ${{ toJson(github.event.pull_request.labels.*.name) }}
47
+ npm-token: ${{ env.NPM_TOKEN }}
96
48
  issue-number: ${{ github.event.number }}
97
- body: |
98
- 🎉 Successfully released alpha version 🎉
99
- ✅ ${{ needs.on-push-commit-bump-and-publish-alpha.outputs.version }}
49
+ github-token: ${{ secrets.GITHUB_TOKEN }}
50
+ run-ci: true
51
+ run-tsc: true
@@ -0,0 +1,80 @@
1
+ # @latest on npm
2
+ latestVersionNPM=$(npm show ./ dist-tags.latest --json)
3
+ echo "Latest dist-tag version on npm: $latestVersionNPM"
4
+
5
+ # Initial package.json version
6
+ packageJSONVersion=$(sed -nE 's/^\s*"version": "([0-9]+.[0-9]+.[0-9]+).*?",$/\1/p' package.json)
7
+ echo "Initial package.json version: $packageJSONVersion"
8
+
9
+ npmV=`echo $latestVersionNPM | sed 's/\.//g' | bc`
10
+ pkgV=`echo $packageJSONVersion | sed 's/\.//g' | bc`
11
+
12
+ # Check if the packageJSONVersion is up to date.
13
+ # Otherwise, bump the package.json version, accordingly to the label.
14
+ if [[ $npmV -lt $pkgV ]]; then
15
+ echo "package.json version is up to date"
16
+ else
17
+ # Set package.json to latest NPM version prior to bump version
18
+ sed -i 's/\("version": \)\("[0-9]\+.[0-9]\+.[0-9]\+\)\(\"\)/\1\'$latestVersionNPM'/' package.json
19
+ case "$1" in
20
+ *"major"*)
21
+ echo "Bumping pre-major version"
22
+ echo "$(npm version --no-git-tag-version premajor --preid alpha)"
23
+ ;;
24
+ *"minor"*)
25
+ echo "Bumping pre-minor version"
26
+ echo $(npm version --no-git-tag-version preminor --preid alpha)
27
+ ;;
28
+ *"patch"*)
29
+ echo "Bumping pre-patch version"
30
+ echo "$(npm version --no-git-tag-version prepatch --preid alpha)"
31
+ ;;
32
+ *)
33
+ echo "No [major, minor, patch] label has been set"
34
+ ;;
35
+ esac
36
+ fi
37
+
38
+ # Get all published versions on npm.
39
+ allVersionsArray=$(npm show ./ versions)
40
+ # Get the current version from the package.json
41
+ upToDatePackageJSON=$(sed -nE 's/^\s*"version": "([0-9]+.[0-9]+.[0-9]+).*?",$/\1/p' package.json)
42
+
43
+ # Identify the latest published alpha (if any) on npm, of the upToDatePackageJSON.
44
+ for i in ${allVersionsArray[@]}
45
+ do
46
+ if [[ $i == *$upToDatePackageJSON* ]]; then
47
+ latestAlphaVersion=$(echo $i)
48
+ fi
49
+ done
50
+
51
+ # Get the alpha counter value of the latest alpha version (for the upToDatePackageJSON version).
52
+ alphaVersionCounter="$(echo "$latestAlphaVersion" | grep -oP '(?:-alpha.)\K\d+')"
53
+
54
+ # Bumping the alphaVersionCounter by 1.
55
+ if [[ "$alphaVersionCounter" != "" ]];
56
+ then
57
+ alphaVersionCounter="$((alphaVersionCounter+1))"
58
+ else
59
+ alphaVersionCounter="0"
60
+ fi
61
+
62
+ # Get the current packageVersion and check if -alpha.X tag has been set (in case of package.json version bump (Open PR))
63
+ packageVersion=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
64
+ if [[ "$packageVersion" == *"-alpha"* ]];
65
+ then
66
+ # On open PR
67
+ # Set alpha tag to the correspondent version
68
+ echo "Setting alpha version to $alphaVersionCounter"
69
+ sed -i 's/\("version": "[0-9]\+.[0-9]\+.[0-9]\+\)\(-alpha.\)\([0-9]\)/\1\'-alpha.$alphaVersionCounter'/' package.json
70
+ bumpedPackageVersion=$(sed -nE 's/^\s*"version": "([0-9]+.[0-9]+.[0-9]+).*?",$/\1/p' package.json)
71
+ # Commit changes
72
+ git add package.json
73
+ git commit -m "autobump $bumpedPackageVersion"
74
+ else
75
+ echo "on push"
76
+ # On push commit
77
+ # Set alpha tag to the correspondent version
78
+ echo "Setting alpha version to $alphaVersionCounter"
79
+ sed -i 's/\("version": "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)\("\)/\1\2\-alpha.'$alphaVersionCounter'\3/' package.json
80
+ fi
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/types",
3
- "version": "2.1.38-alpha.0",
4
- "alphaVersionCounter": "0",
3
+ "version": "2.1.39-alpha.0",
5
4
  "description": "Enums, interfaces, and other common types for use in Hedia's software.",
6
5
  "main": "dist/index.js",
7
6
  "repository": {
@@ -11,9 +10,7 @@
11
10
  "scripts": {
12
11
  "tsc": "tsc --build",
13
12
  "clean": "tsc --build --clean",
14
- "prepublish": "npm ci --ignore-scripts && npm run tsc",
15
- "postpublish": "npm run clean",
16
- "bump-alpha": "chmod +x ./alpha-release.sh && ./alpha-release.sh"
13
+ "postpublish": "npm run clean"
17
14
  },
18
15
  "keywords": [],
19
16
  "author": "Hedia",
@@ -1,19 +1,15 @@
1
- versionNumber=$(sed -nE 's/^\s*"version": "([0-9].[0-9].[0-9]).*?",$/\1/p' package.json)
2
1
  alphaNumber="$(sed -n 's/\("version": "[0-9]\+\.[0-9]\+\.[0-9]\+\-alpha\.\)\([0-9]\+\)\("\)\(,\)/\2/p' package.json)"
3
- alphaVersion="$(sed -nE 's/^\s*"alphaVersionCounter": "(.*?)",$/\1/p' package.json)"
4
2
 
3
+ previousCommit="$(git log -1 --pretty=%B)"
5
4
 
6
5
  if [ "$alphaNumber" != "" ];
7
6
  then
8
7
  sed -i 's/\("version": "[0-9]\+\.[0-9]\+\.[0-9]\+\)\(-alpha\.\)\([0-9]\+\)\("\)/\1\4/' package.json
9
8
  fi
10
9
 
11
- git add package.json
12
-
13
- if [ "$alphaVersion" = "" ] || [ $alphaVersion = "0" ];
10
+ if [[ "$previousCommit" == *"autobump"* ]];
14
11
  then
15
- git commit --amend -m "autobump ${versionNumber}-alpha.${alphaVersion}"
16
- else
17
- git commit -m "autobump ${versionNumber}-alpha.${alphaVersion}"
18
- fi
19
-
12
+ git add package.json
13
+ git commit --amend --no-edit
14
+ git push
15
+ fi
@@ -1,24 +0,0 @@
1
- name: Node.js CI
2
-
3
- on:
4
- pull_request:
5
-
6
- jobs:
7
- build:
8
- runs-on: ubuntu-latest
9
-
10
- strategy:
11
- matrix:
12
- node-version: [14.15]
13
-
14
- steps:
15
- - uses: actions/checkout@v2
16
-
17
- - name: Use Node.js ${{ matrix.node-version }}
18
- uses: actions/setup-node@v2
19
- with:
20
- node-version: ${{ matrix.node-version }}
21
-
22
- - run: npm ci
23
- env:
24
- CI: true
@@ -1,8 +0,0 @@
1
- alphaNumber="$(sed -n 's/\("version": "[0-9]\+\.[0-9]\+\.[0-9]\+\-alpha\.\)\([0-9]\+\)\("\)\(,\)/\2/p' package.json)"
2
- bumpedAlphaNumber="$((alphaNumber+1))"
3
-
4
- alphaVersion="$(sed -nE 's/^\s*"alphaVersionCounter": "(.*?)",$/\1/p' package.json)"
5
- bumpedAlphaVersion="$((alphaVersion+1))"
6
-
7
- sed -i 's/\("alphaVersionCounter": "\)\([0-9]\+\)\("\)/\1'0'\3/' package.json
8
- sed -i 's/\("version": "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)\("\)/\1\2\-alpha.'0'\3/' package.json
@@ -1,8 +0,0 @@
1
- alphaNumber="$(sed -n 's/\("version": "[0-9]\+\.[0-9]\+\.[0-9]\+\-alpha\.\)\([0-9]\+\)\("\)\(,\)/\2/p' package.json)"
2
- bumpedAlphaNumber="$((alphaNumber+1))"
3
-
4
- alphaVersion="$(sed -nE 's/^\s*"alphaVersionCounter": "(.*?)",$/\1/p' package.json)"
5
- bumpedAlphaVersion="$((alphaVersion+1))"
6
-
7
- sed -i 's/\("version": "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)\("\)/\1\2\-alpha.'$bumpedAlphaVersion'\3/' package.json
8
- sed -i 's/\("alphaVersionCounter": "\)\([0-9]\+\)\("\)/\1'$bumpedAlphaVersion'\3/' package.json