2929 contents : write
3030 steps :
3131
32- - run : curl -o 'GitVersion.yml' 'https://gist.githubusercontent.com/KamaranL/9e5c6d02123d4ef984a676e57602a4ef/raw/ContinuousDeployment.yml'
33- working-directory : ${{ runner.temp }}
34-
3532 - uses : actions/checkout@v4
3633 with :
3734 fetch-depth : 0
@@ -41,23 +38,13 @@ jobs:
4138
4239 - run : npm run test
4340
41+ - run : npm run build:docs
42+
4443 - run : |
45- SSH="${{ runner.temp }}/ssh"
46- mkdir -p $SSH
47- echo -e "${{ secrets.SSH_ID }}" >"$SSH/id"
48- echo -e "${{ secrets.SSH_ID_PUB }}" >"$SSH/id.pub"
49- echo -e "${{ secrets.SSH_ALLOWED_SIGNERS }}" >"$SSH/allowed_signers"
50- chmod 0600 "$SSH/id"
51-
52- git config --global user.name "GitHub Actions"
53- git config --global user.email "[email protected] " 54- git config --global user.signingkey "$SSH/id.pub"
55- git config --global gpg.format "ssh"
56- git config --global gpg.ssh.allowedsignersfile "$SSH/allowed_signers"
57- git config --global commit.gpgsign true
58- git config --global tag.gpgsign true
59- git config --global push.followtags true
60- name: Set up Git
44+ source <(curl -s -H "Authorization: token $GH_TOKEN" 'https://gist.githubusercontent.com/KamaranL/a3e6bc50b52459b103f6b36ec3428f5d/raw/.action_profile')
45+ env:
46+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+ name: Set up environment
6148
6249 - uses : gittools/actions/gitversion/setup@v0
6350 with :
@@ -66,43 +53,35 @@ jobs:
6653 - uses : gittools/actions/gitversion/execute@v0
6754 with :
6855 useConfigFile : true
69- configFilePath : ' ${{ runner.temp }}/GitVersion.yml'
70-
71- - run : |
72- [ "${{ github.event_name }}" == workflow_dispatch -a "${{ github.ref_name }}" != main ] && echo "CI_CREATE_TAG=true" >>"$GITHUB_ENV"
73-
74- echo "CI_VERSION=${{ env.GITVERSION_FULLSEMVER }}" >>"$GITHUB_ENV"
75- echo "CI_BRANCH=${{ github.ref_name }}" >>"$GITHUB_ENV"
76-
77- if [ "${{ github.event_name }}" == pull_request -a "${{ github.base_ref }}" == main -a "${{ github.head_ref }}" == dev ]; then
78- echo "CI_VERSION=${{ env.GITVERSION_MAJORMINORPATCH }}" >>"$GITHUB_ENV"
79- echo "CI_BRANCH=${{ github.head_ref }}" >>"$GITHUB_ENV"
80- echo "CI_CREATE_TAG=true" >>"$GITHUB_ENV"
56+ configFilePath : ' ${{ env.GV_CONFIG }}'
8157
82- gh release view v1.0.0 >/dev/null 2>&1 || echo "CI_VERSION=1.0.0" >>"$GITHUB_ENV"
83- fi
84- env:
85- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86- name: Set CI_ vars
58+ - run : bash $CI_SCRIPT
59+ name : Set CI vars
8760
8861 - run : |
89- echo ${{ env. CI_VERSION }} >VERSION.txt
90- npm version --quiet --allow-same-version --no-commit-hooks --no-git-tag-version ${{ env. CI_VERSION }}
62+ echo "$ CI_VERSION" >VERSION.txt
63+ npm version --quiet --allow-same-version --no-commit-hooks --no-git-tag-version "$ CI_VERSION"
9164 name: Update manifests
9265
9366 - run : |
67+ source $GH_RC
68+
9469 git commit -a --amend --no-edit --date=now --trailer "skip-checks: true"
9570
96- [ ${{ env. CI_CREATE_TAG }} ] && git tag -a v${{ env. CI_VERSION }} -m v${{ env. CI_VERSION }} $(git rev-parse HEAD) && echo " CI_CREATE_RELEASE=true" >>"$GITHUB_ENV "
71+ [ $CI_CREATE_TAG ] && git tag -a v$CI_VERSION -m v$CI_VERSION $(git rev-parse HEAD) && core.set-env CI_CREATE_RELEASE "true "
9772
98- git push origin $(git rev-parse HEAD):${{ env. CI_BRANCH }} --force-with-lease
73+ git push origin $(git rev-parse HEAD):$CI_BRANCH --force-with-lease
9974 name: Commit back to source
10075
101- - run : gh release create v${{ env.CI_VERSION }} --generate-notes --verify-tag && echo "CI_CD=true" >>"$GITHUB_OUTPUT" && echo "CI_TAG=v${{ env.CI_VERSION }}" >>"$GITHUB_OUTPUT"
76+ - run : |
77+ source $GH_RC
78+
79+ gh release create v$CI_VERSION --latest --generate-notes --verify-tag && core.set-output CI_CD "true" && core.set-output CI_TAG "v$CI_VERSION"
10280 id: release
10381 if: env.CI_CREATE_RELEASE
10482 env:
10583 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+ name: Create release v${{ env.CI_VERSION }}
10685
10786 outputs :
10887 cd : ${{ steps.release.outputs.CI_CD }}
11291 needs : ci
11392 if : needs.ci.outputs.cd
11493 runs-on : ubuntu-latest
115- permissions :
116- packages : write
11794 steps :
11895
11996 - uses : actions/checkout@v4
@@ -131,6 +108,14 @@ jobs:
131108 node-version : ' latest'
132109 registry-url : ' https://registry.npmjs.org'
133110
134- - run : npm publish
111+ - run : |
112+ source <(curl -s -H "Authorization: token $GH_TOKEN" 'https://gist.githubusercontent.com/KamaranL/e0c9feb6f3bc2a296cef3258c5fdc184/raw/.actionrc')
113+
114+ NPM_TOKEN=$(get-secret NPM.CICD)
115+ core.add-mask "$NPM_TOKEN"
116+ core.set-env NODE_AUTH_TOKEN "$NPM_TOKEN"
135117 env:
136- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
118+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+ name: Get token
120+
121+ - run : npm publish
0 commit comments