Skip to content

💡 Maintenance 2024-09 (#96) #43

💡 Maintenance 2024-09 (#96)

💡 Maintenance 2024-09 (#96) #43

name: 📦 Publish package
env:
APPLICATION_NAME: cachette
on:
push:
branches:
- master
jobs:
bump_version:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Automated Version Bump ⬆️
run: |
git config --global user.name "UnitoBot"
git config --global user.email "[email protected]"
git remote set-url origin https://UnitoBot:${{ secrets.UNITO_BOT_PAT_TOKEN }}@github.com/${{ github.repository }}
# Eventually use the pull request title to patch, minor or major
npm version patch -m "Bump version to: %s [skip ci]"
git push --no-verify origin master
git push --tags
- name: Checkout GitHub Action Repo
uses: actions/checkout@v2
with:
repository: unitoio/github-actions
token: ${{ secrets.UNITO_BOT_PAT_TOKEN }} # stored in GitHub secrets
path: .github/actions
- name: Get node version ⭐
run: |
echo "NODE_VERSION=$(echo $(jq '.engines.node' package.json) | sed -E 's/"[<>=]*([0-9]([\.0-9a-z]+)?)*.*"/\1/')" >> $GITHUB_ENV
echo "${{ env.NODE_VERSION }}"
- name: Setup Node ${{env.NODE_VERSION}} 📍
uses: actions/setup-node@v1
env:
CI: true
with:
node-version: ${{env.NODE_VERSION}}
registry-url: https://npm.pkg.github.com/
scope: "@unitoio"
# https://github.com/actions/cache
- name: NPM cache 📦
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-${{ env.APPLICATION_NAME }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
- name: NPM install 📦
run: npm ci
- name: Pushes the package to NPM
run: |
echo "Running npm publish"
npm config set '//registry.npmjs.org/:_authToken' ${{ secrets.UNITO_NPM_REGISTRY_TOKEN }}
npm publish