Merge pull request #127 from frontendnetwork/dependabot/npm_and_yarn/… #32
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: Bump version | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip versioning')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 'latest' | |
- name: Bump version and push tag | |
id: bump_version | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
VERSION_TAG=$(npm version patch -m "feat(Version): Bump to %s [skip versioning]") | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git push | |
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION_TAG }} | |
release_name: ${{ env.VERSION_TAG }} | |
build-publish: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: npm registry | |
url: https://www.npmjs.com/package/@frontendnetwork/vegancheck | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '19.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies & build | |
run: npm ci && npm run build | |
- name: Publish package on NPM | |
run: | | |
npm publish | |
npm config set registry https://npm.pkg.github.com | |
npm config set //npm.pkg.github.com/:_authToken ${{ secrets.GH_KEY }} | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
verify-install: | |
needs: build-publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '19.x' | |
- name: Install dependencies | |
run: npm ci | |
- name: Verify package installation | |
run: | | |
PACKAGE_VERSION=$(npm view @frontendnetwork/vegancheck version) | |
echo "Latest version of the package is: $PACKAGE_VERSION" | |
echo "package-version=$PACKAGE_VERSION" >> "$GITHUB_ENV" | |
npm install @frontendnetwork/vegancheck@${{ env.package-version }} | |