Skip to content

Commit cd03324

Browse files
authored
Update to node18 + change auto-release workflow (#43)
1 parent 920ab63 commit cd03324

21 files changed

+2623
-2911
lines changed

.eslintrc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ rules: # See https://eslint.org/docs/rules
4545
quote-props:
4646
- warn
4747
- consistent-as-needed # Enforce consistency with quotes on props, either all must be quoted, or all unquoted for a given object
48-
no-return-await: 0 # Useful before, but recent node.js enhancements make it useless on node 12+ (we use 10, but still, for consistency) - Read https://stackoverflow.com/questions/44806135/why-no-return-await-vs-const-x-await
4948
no-extra-boolean-cast: 0 # Don't enforce, let developer choose. Using "!!!" is sometimes useful (edge cases), and has a semantic value (dev intention)
5049
object-curly-newline:
5150
- warn
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Summary:
2+
# Automatically tag and release when changes land on the "main" branch.
3+
# It uses "semantic-version" to resolve the next version to use, and then we use GitHub CLI to create or update the releases.
4+
#
5+
# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v5.0.2
6+
# See https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/tree/v1
7+
8+
name: 'Auto release'
9+
on:
10+
push:
11+
branches:
12+
- main
13+
14+
jobs:
15+
tag-and-release:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Fetching all commits for the current branch
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0 # Force fetch all commits - See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action
22+
23+
- run: "echo \"GITHUB_SHA: ${{ github.sha }}\""
24+
25+
# Outputs documentation: https://github.com/PaulHatch/semantic-version/blob/master/src/main.ts#L22-L33
26+
- name: Resolving next Release Candidate version using semantic-version
27+
uses: paulhatch/semantic-version@v5.0.2
28+
id: next_semantic_version
29+
with: # See https://github.com/PaulHatch/semantic-version#usage
30+
tag_prefix: "v" # The prefix to use to identify tags
31+
major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change
32+
minor_pattern: "(MINOR)" # Same as above except indicating a minor change
33+
version_format: "${major}.${minor}.${patch}-rc.${increment}" # A string to determine the format of the version output
34+
bump_each_commit: true # If this input is set to true, every commit will be treated as a new version, bumping the patch, minor, or major version based on the commit message.
35+
36+
- name: Printing semantic-version outputs (for debugging)
37+
run: |
38+
echo "Most useful outputs:"
39+
echo "Next version: ${{steps.next_semantic_version.outputs.version}}"
40+
echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}"
41+
echo -e "\n All outputs:"
42+
echo "version: ${{steps.next_semantic_version.outputs.version}}"
43+
echo "major: ${{steps.next_semantic_version.outputs.major}}"
44+
echo "minor: ${{steps.next_semantic_version.outputs.minor}}"
45+
echo "patch: ${{steps.next_semantic_version.outputs.patch}}"
46+
echo "increment: ${{steps.next_semantic_version.outputs.increment}}"
47+
echo "version_type: ${{steps.next_semantic_version.outputs.version_type}}"
48+
echo "changed: ${{steps.next_semantic_version.outputs.changed}}"
49+
echo "authors: ${{steps.next_semantic_version.outputs.authors}}"
50+
echo "version_tag: ${{steps.next_semantic_version.outputs.version_tag}}"
51+
echo "previous_commit: ${{steps.next_semantic_version.outputs.previous_commit}}"
52+
echo "current_commit: ${{steps.next_semantic_version.outputs.current_commit}}"
53+
54+
- name: Creating Git release tag for the "${{steps.next_semantic_version.outputs.version_tag}}" version
55+
run: |
56+
gh release create ${{steps.next_semantic_version.outputs.version_tag}} \
57+
--title "${{steps.next_semantic_version.outputs.version_tag}}" \
58+
--latest \
59+
--generate-notes \
60+
--target "${{github.sha}}"
61+
env:
62+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
63+
64+
# Check if the major version already exists (if it doesn't, we'll create it - if it does, we'll update it)
65+
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}" exists
66+
uses: mukunku/tag-exists-action@v1.2.0
67+
id: majorTagExists
68+
with: # See https://github.com/mukunku/tag-exists-action#inputs
69+
tag: "v${{steps.next_semantic_version.outputs.major}}"
70+
71+
- run: "echo \"Check if majorTagExists: ${{ steps.majorTagExists.outputs.exists }}\""
72+
73+
# See https://cli.github.com/manual/gh_release_create
74+
- name: Creating new release for the major "v${{steps.next_semantic_version.outputs.major}}" version
75+
if: ${{ steps.majorTagExists.outputs.exists == 'false' }}
76+
run: |
77+
gh release create v${{steps.next_semantic_version.outputs.major}} \
78+
--title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \
79+
--generate-notes \
80+
--target "${{github.sha}}"
81+
env:
82+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
83+
84+
# See https://cli.github.com/manual/gh_release_edit
85+
- name: Recreating existing release for the major "v${{steps.next_semantic_version.outputs.major}}" version
86+
if: ${{ steps.majorTagExists.outputs.exists == 'true' }}
87+
run: |
88+
# Delete and create the release again
89+
gh release delete v${{steps.next_semantic_version.outputs.major}} --cleanup-tag --yes
90+
91+
gh release create v${{steps.next_semantic_version.outputs.major}} \
92+
--title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \
93+
--generate-notes \
94+
--target "${{github.sha}}"
95+
env:
96+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
97+
98+
# Check if the minor version already exists (if it doesn't, we'll create it - if it does, we'll update it)
99+
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" exists
100+
uses: mukunku/tag-exists-action@v1.2.0
101+
id: minorTagExists
102+
with: # See https://github.com/mukunku/tag-exists-action#inputs
103+
tag: "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}"
104+
105+
- run: "echo \"Check if minorTagExists: ${{ steps.minorTagExists.outputs.exists }}\""
106+
107+
# See https://cli.github.com/manual/gh_release_create
108+
- name: Creating new release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version
109+
if: ${{ steps.minorTagExists.outputs.exists == 'false' }}
110+
run: |
111+
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \
112+
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \
113+
--generate-notes \
114+
--target "${{github.sha}}"
115+
env:
116+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
117+
118+
# See https://cli.github.com/manual/gh_release_edit
119+
- name: Recreating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version
120+
if: ${{ steps.minorTagExists.outputs.exists == 'true' }}
121+
run: |
122+
# Delete and create the release again
123+
gh release delete v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} --cleanup-tag --yes
124+
125+
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \
126+
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \
127+
--generate-notes \
128+
--target "${{github.sha}}"
129+
env:
130+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Summary:
2+
# Automatically tag and release when changes land on the "main" branch.
3+
# It uses "semantic-version" to resolve the next version to use, and then we use GitHub CLI to create or update the releases.
4+
#
5+
# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v5.0.2
6+
# See https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/tree/v1
7+
8+
name: 'Auto release (release candidate)'
9+
on:
10+
push:
11+
branches-ignore:
12+
- main
13+
14+
jobs:
15+
tag-and-release:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Fetching all commits for the current branch
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0 # Force fetch all commits - See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action
22+
23+
- run: "echo \"GITHUB_SHA: ${{ github.sha }}\""
24+
25+
# Outputs documentation: https://github.com/PaulHatch/semantic-version/blob/master/src/main.ts#L22-L33
26+
- name: Resolving next Release Candidate version using semantic-version
27+
uses: paulhatch/semantic-version@v5.0.2
28+
id: next_semantic_version
29+
with: # See https://github.com/PaulHatch/semantic-version#usage
30+
tag_prefix: "v" # The prefix to use to identify tags
31+
major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change
32+
minor_pattern: "(MINOR)" # Same as above except indicating a minor change
33+
version_format: "${major}.${minor}.${patch}-rc.${increment}" # A string to determine the format of the version output
34+
bump_each_commit: false # If this input is set to true, every commit will be treated as a new version, bumping the patch, minor, or major version based on the commit message.
35+
36+
- name: Printing semantic-version outputs (for debugging)
37+
run: |
38+
echo "Most useful outputs:"
39+
echo "Next version: ${{steps.next_semantic_version.outputs.version}}"
40+
echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}"
41+
echo -e "\n All outputs:"
42+
echo "version: ${{steps.next_semantic_version.outputs.version}}"
43+
echo "major: ${{steps.next_semantic_version.outputs.major}}"
44+
echo "minor: ${{steps.next_semantic_version.outputs.minor}}"
45+
echo "patch: ${{steps.next_semantic_version.outputs.patch}}"
46+
echo "increment: ${{steps.next_semantic_version.outputs.increment}}"
47+
echo "version_type: ${{steps.next_semantic_version.outputs.version_type}}"
48+
echo "changed: ${{steps.next_semantic_version.outputs.changed}}"
49+
echo "authors: ${{steps.next_semantic_version.outputs.authors}}"
50+
echo "version_tag: ${{steps.next_semantic_version.outputs.version_tag}}"
51+
echo "previous_commit: ${{steps.next_semantic_version.outputs.previous_commit}}"
52+
echo "current_commit: ${{steps.next_semantic_version.outputs.current_commit}}"
53+
54+
# Check if the major version already exists (if it doesn't, we'll create it - if it does, we'll update it)
55+
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}-rc" exists
56+
uses: mukunku/tag-exists-action@v1.2.0
57+
id: majorTagExists
58+
with: # See https://github.com/mukunku/tag-exists-action#inputs
59+
tag: "v${{steps.next_semantic_version.outputs.major}}-rc"
60+
61+
- run: "echo \"Check if majorTagExists: ${{ steps.majorTagExists.outputs.exists }}\""
62+
63+
# See https://cli.github.com/manual/gh_release_create
64+
- name: Creating new release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version
65+
if: ${{ steps.majorTagExists.outputs.exists == 'false' }}
66+
run: |
67+
gh release create v${{steps.next_semantic_version.outputs.major}}-rc \
68+
--title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \
69+
--generate-notes \
70+
--prerelease \
71+
--target "${{github.sha}}"
72+
env:
73+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
74+
75+
# See https://cli.github.com/manual/gh_release_edit
76+
- name: Recreating existing release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version
77+
if: ${{ steps.majorTagExists.outputs.exists == 'true' }}
78+
run: |
79+
# Delete and create the release again
80+
gh release delete v${{steps.next_semantic_version.outputs.major}}-rc --cleanup-tag --yes
81+
82+
gh release create v${{steps.next_semantic_version.outputs.major}}-rc \
83+
--title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \
84+
--generate-notes \
85+
--prerelease \
86+
--target "${{github.sha}}"
87+
env:
88+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
89+
90+
# Check if the minor version already exists (if it doesn't, we'll create it - if it does, we'll update it)
91+
- name: Check if tag "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" exists
92+
uses: mukunku/tag-exists-action@v1.2.0
93+
id: minorTagExists
94+
with: # See https://github.com/mukunku/tag-exists-action#inputs
95+
tag: "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc"
96+
97+
- run: "echo \"Check if minorTagExists: ${{ steps.minorTagExists.outputs.exists }}\""
98+
99+
# See https://cli.github.com/manual/gh_release_create
100+
- name: Creating new release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version
101+
if: ${{ steps.minorTagExists.outputs.exists == 'false' }}
102+
run: |
103+
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \
104+
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \
105+
--generate-notes \
106+
--prerelease \
107+
--target "${{github.sha}}"
108+
env:
109+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
110+
111+
# See https://cli.github.com/manual/gh_release_edit
112+
- name: Recreating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version
113+
if: ${{ steps.minorTagExists.outputs.exists == 'true' }}
114+
run: |
115+
# Delete and create the release again
116+
gh release delete v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc --cleanup-tag --yes
117+
118+
gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \
119+
--title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \
120+
--generate-notes \
121+
--prerelease \
122+
--target "${{github.sha}}"
123+
env:
124+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/auto-git-release.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/auto-tag-on-release.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v14.16.1
1+
v18

0 commit comments

Comments
 (0)