ready for ci/cd #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CI/CD NPM" | |
on: | |
push: | |
branches: [main] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: node | |
uses: actions/setup-node@v2 | |
with: | |
clean: true | |
node-version: 20 | |
registry-url: https://registry.npmjs.org | |
- name : "configuring git" | |
run: | | |
git config --global user.email "${{github.actor}}@users.noreply.github.com" | |
git config --global user.name "${{github.actor}}" | |
- name : "install_dependencies" | |
run: npm install | |
working-directory: ./ | |
- name : "check build" | |
run: npm pack --dry-run | |
working-directory: ./ | |
- name : "versioning" | |
run: | | |
# based on repo | |
# repository="${{github.repository}}" | |
# IFS='/' read -ra parts <<< "${repository}" | |
# latest_version=$(npm view "${parts[1]}" version) | |
package_name=$(node -e "console.log(require('./package.json').name)") | |
latest_version=$(npm view "${package_name}" version) | |
npm version "$latest_version" --no-git-tag-version | |
npm version patch --no-git-tag-version | |
working-directory: ./ | |
- name : "build" | |
run: npm run build | |
working-directory: ./ | |
- name : "publish" | |
run: npm publish --access public | |
working-directory: ./ | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.PVSCREATIONS}} |