Merge pull request #995 from mbrevda/renovate/prettier-3.x #1130
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: Build and Deploy | |
on: push | |
env: | |
CI: true | |
NODE_VER: 19 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
- uses: bahmutov/npm-install@v1 | |
- name: prettier | |
run: npx prettier '**/*.{js?(on|x),ts?(x),y?(a)ml,graphql,md,css}' --check | |
- name: typescript | |
run: npx tsc --noEmit | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
- uses: bahmutov/npm-install@v1 | |
- name: build | |
run: npm run build | |
- name: build package | |
run: npm version --no-git-tag-version 0.0.0-${{ github.sha }} && npm pack | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: react-image-0.0.0-${{ github.sha }}.tgz | |
path: react-image-0.0.0-${{ github.sha }}.tgz | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
- uses: bahmutov/npm-install@v1 | |
- name: test | |
run: npm test | |
- name: download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: test built libs | |
run: npm run test:dist | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
if: ${{ github.ref_name == 'master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
- uses: bahmutov/npm-install@v1 | |
- name: setup .npmrc | |
run: npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
- name: download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: check if package is newer than the published version | |
id: checkPublish | |
run: echo "::set-output name=shouldPublish::`npm run -s isNewerThanPublished`" | |
- name: publish release package if needed | |
if: steps.checkPublish.outputs.shouldPublish == 'true' | |
run: npm publish |