[NO JIRA]: Update CI for dev and stable releases (#186) #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: main-release | |
on: | |
push: | |
branches: [main] | |
release: | |
types: [ published ] | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
ReleaseWeb: | |
name: Release dev version to NPM | |
runs-on: ubuntu-latest | |
environment: Publishing | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install | |
run: npm ci --prefer-offline | |
- name: Build react-error-overlay | |
run: | | |
cd packages/react-error-overlay/ | |
npm run build:prod | |
- name: Build | |
run: npm run build | |
- name: Publish dev NPM package | |
if: ${{ github.event_name != 'release' && github.ref_name != github.event.repository.default_branch }} | |
run: | | |
cd packages/react-scripts | |
npm version prerelease --preid=$BUILD_VERSION-dev --no-git-tag-version | |
npm publish --tag alpha | |
env: | |
BUILD_VERSION: ${{ github.run_number }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish release NPM package | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
cd packages/react-scripts | |
npm version $RELEASE_VERSION --no-git-tag-version | |
npm publish | |
env: | |
RELEASE_VERSION: ${{ github.event.release.tag_name }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |