Merge pull request #52 from neptunelabs/rebuild #12
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: Merge CI | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish-npm: | |
name: On Merge-Push CI | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if version has been updated | |
id: check | |
uses: EndBug/version-check@v2 | |
with: | |
diff-search: true | |
file-name: package.json | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get version | |
if: steps.check.outputs.changed == 'true' | |
run: echo "client_version=$(node -pe "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Tag and push | |
if: steps.check.outputs.changed == 'true' | |
run: | | |
git tag v${{ env.client_version }} | |
git push origin v${{ env.client_version }} | |
- name : Setup Node | |
if: steps.check.outputs.changed == 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
if: steps.check.outputs.changed == 'true' | |
run: npm ci | |
- name: Build mod | |
if: steps.check.outputs.changed == 'true' | |
run: npm run build-mod | |
- name: Build Web Lib | |
if: steps.check.outputs.changed == 'true' | |
run: npm run build | |
- name: Publish to NPM | |
if: steps.check.outputs.changed == 'true' | |
run: cd ./dist && npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Build project # This would actually build your project, using zip for an example artifact | |
if: steps.check.outputs.changed == 'true' | |
run: | | |
zip --junk-paths fsi_server_api_client dist/* | |
- name: Get version | |
if: steps.check.outputs.changed == 'true' | |
run: echo "client_version=$(node -pe "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Create Release | |
if: steps.check.outputs.changed == 'true' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.client_version }} | |
release_name: Release v${{ env.client_version }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
if: steps.check.outputs.changed == 'true' | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./fsi_server_api_client.zip | |
asset_name: fsi_server_api_client.zip | |
asset_content_type: application/zip |