Merge pull request #182 from okp4/dependabot/npm_and_yarn/micromatch-β¦ #355
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: Publish | |
on: | |
push: | |
branches: [main] | |
tags: ["v*"] | |
pull_request: | |
branches: [main] | |
jobs: | |
publish-npm-package-okp4: | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: publish-npm-package-okp4-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up context | |
id: project_context | |
uses: FranzDiebold/[email protected] | |
- name: Setup node environment (for publishing) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.18 | |
registry-url: "https://npm.pkg.github.com" | |
scope: "@okp4" | |
- name: Publish package | |
run: | | |
DATE=$(date +%Y%m%d%H%M%S) | |
yarn | |
publish=(yarn publish --no-git-tag-version --non-interactive) | |
if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
publish+=(--tag latest) | |
elif [[ $GITHUB_EVENT_NAME == pull_request ]]; then | |
publish+=(--prerelease --preid ${{ env.CI_ACTION_REF_NAME_SLUG }}.$DATE --tag ${{ env.CI_ACTION_REF_NAME_SLUG }}) | |
else | |
publish+=(--prerelease --preid next.$DATE --tag next) | |
fi | |
echo "π Publishing npm package with following command line: ${publish[@]}" | |
"${publish[@]}" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }} | |
publish-npm-package-public: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: publish-npm-package-public-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up context | |
id: project_context | |
uses: FranzDiebold/[email protected] | |
- name: Setup node environment (for publishing) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.18 | |
registry-url: "https://registry.npmjs.org" | |
scope: "@okp4" | |
- name: Publish package | |
run: | | |
yarn | |
publish=(yarn publish --access=public --no-git-tag-version --non-interactive) | |
publish+=(--tag latest) | |
echo "π Publishing npm package with following command line: ${publish[@]}" | |
"${publish[@]}" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLIC_REGISTRY_TOKEN }} |