Commit 240ff79 1 parent c0dea69 commit 240ff79 Copy full SHA for 240ff79
File tree 3 files changed +19
-13
lines changed
3 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,18 @@ permissions:
17
17
18
18
jobs :
19
19
publish :
20
+ env :
21
+ VERSION : ${{ inputs.tag }}
20
22
runs-on : ubuntu-latest
21
23
steps :
22
24
- uses : actions/checkout@v4
23
25
with :
24
26
fetch-depth : 0
25
27
- name : Set env vars
26
28
run : |
27
- echo PKG_VERSION="$(yarn -s run get-version)" >> $GITHUB_ENV
28
- echo PKG_NAME="$(yarn -s run get-package-name)" >> $GITHUB_ENV
29
- echo PKG_BASENAME="$(yarn -s run get-package-basename)" >> $GITHUB_ENV
30
- echo VERSION="${{ inputs.tag }}" >> $GITHUB_ENV
29
+ echo PKG_VERSION="$(jq -r .version < package.json)" >> $GITHUB_ENV
30
+ echo PKG_NAME="$(jq -r .name < package.json)" >> $GITHUB_ENV
31
+ echo PKG_BASENAME="$(basename $(jq -r .name < package.json))" >> $GITHUB_ENV
31
32
- name : Ensure the branch is protected
32
33
run : |
33
34
if [[ "${{ github.ref_protected }}" == "false" ]]; then
38
39
run : |
39
40
TAG_EXISTS=$(git tag -l "${{ inputs.tag }}")
40
41
if [[ -n "$TAG_EXISTS" ]]; then
41
- echo "::error::The tag ${{ inputs.tag }} has already been released "
42
+ echo "::error::The tag ${{ inputs.tag }} already exists "
42
43
exit 1
43
44
fi
44
45
- name : Ensure version is properly set
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ name: tests
4
4
on :
5
5
push :
6
6
branches-ignore :
7
- - ' development/** '
7
+ - q/*/*
8
8
9
9
permissions :
10
10
packages : write
27
27
run : yarn lint_md
28
28
- name : lint javascript
29
29
run : yarn lint
30
- - name : Set development version
31
- run : yarn version --no-git-tag-version --new-version "0.0.0-sha.${{ github.sha }}"
30
+ - name : Set common env vars for npm publish
31
+ run : |
32
+ echo "SHORTSHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
33
+ echo "PKG_VERSION=$(jq -r .version < package.json)" >> $GITHUB_ENV
34
+ - name : Set version for work in progress
35
+ run : yarn version --no-git-tag-version --new-version "0.0.0-sha.${SHORTSHA}"
36
+ if : github.ref_protected == false
37
+ - name : Set version for protected branch
38
+ run : yarn version --no-git-tag-version --new-version "${PKG_VERSION}-sha.${SHORTSHA}"
39
+ if : github.ref_protected
32
40
- name : Publish development version
33
- run : npm publish --provenance
41
+ run : npm publish --provenance --tag "${{ github.ref_name }}"
34
42
env :
35
43
NODE_AUTH_TOKEN : ${{ github.token }}
Original file line number Diff line number Diff line change 9
9
"scripts" : {
10
10
"test" : " npm run --silent lint && npm run --silent lint_md" ,
11
11
"lint" : " eslint -c index.js $(git ls-files '*.js')" ,
12
- "lint_md" : " node bin/mdlint.js $(git ls-files '*.md')" ,
13
- "get-version" : " echo $npm_package_version" ,
14
- "get-package-name" : " echo $npm_package_name" ,
15
- "get-package-basename" : " basename $npm_package_name"
12
+ "lint_md" : " node bin/mdlint.js $(git ls-files '*.md')"
16
13
},
17
14
"repository" : {
18
15
"type" : " git" ,
You can’t perform that action at this time.
0 commit comments