Skip to content

Merge pull request #161 from Phanindra-tw/master #13

Merge pull request #161 from Phanindra-tw/master

Merge pull request #161 from Phanindra-tw/master #13

name: Build and Release
on:
push:
branches:
- create-npm-package
workflow_dispatch:
jobs:
build-release:
name: Build the web app and make a zip release
runs-on: ubuntu-latest
steps:
- name: Checkout to repository
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
- name: Build the app
run: yarn build-prod
- id: versionCheck
uses: EndBug/version-check@v2
with:
file-url: https://unpkg.com/person-management-app@latest/package.json
static-checking: localIsNew
- name: Version guard
if: steps.versionCheck.outputs.changed == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('No version change detected. You should run `yarn bump:<patch|minor|major>` to bump the version')
- name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
yarn publish --new-version ${{ steps.versionCheck.outputs.version }}
- id: versionCheck

Check failure on line 48 in .github/workflows/build_publish.yaml

View workflow run for this annotation

GitHub Actions / Build and Release

Invalid workflow file

The workflow is not valid. .github/workflows/build_publish.yaml (Line: 48, Col: 13): The identifier 'versionCheck' may not be used more than once within the same scope.
uses: EndBug/version-check@v2
with:
file-url: https://unpkg.com/person-management-app@latest/package.json
static-checking: localIsNew
- name: Version guard
if: steps.versionCheck.outputs.changed == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('No version change detected. You should run `yarn bump:<patch|minor|major>` to bump the version')
- name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
yarn publish --new-version ${{ steps.versionCheck.outputs.version }}
- name: Create Tag
uses: actions/github-script@v5
env:
VERSION: ${{ steps.versionCheck.outputs.version }}
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v' + process.env.VERSION,
sha: context.sha
})