2020-02-09 19:03:42 +03:00
|
|
|
name: release-npm
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- '**/package.json'
|
2020-02-10 01:35:23 +03:00
|
|
|
- '.github/workflows/**'
|
2020-02-09 19:03:42 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
package:
|
|
|
|
- name: tauri.js
|
|
|
|
registryName: tauri
|
|
|
|
path: cli/tauri.js
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: master
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: get version
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: echo ::set-env name=PACKAGE_VERSION::$(node -p "require('./package.json').version")
|
|
|
|
- name: check published version
|
|
|
|
run: echo ::set-env name=PUBLISHED_VERSION::$(npm view ${{ matrix.package.registryName }} version)
|
2020-02-10 01:35:23 +03:00
|
|
|
- name: yarn install
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
2020-02-10 02:01:20 +03:00
|
|
|
working-directory: ${{ matrix.package.path }}
|
2020-02-10 01:35:23 +03:00
|
|
|
run: yarn
|
2020-02-09 19:03:42 +03:00
|
|
|
- name: npm pack
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: |
|
|
|
|
echo "pack dir:"
|
|
|
|
ls
|
|
|
|
npm pack
|
|
|
|
echo "We will publish:" $PACKAGE_VERSION
|
|
|
|
echo "This is current latest:" $PUBLISHED_VERSION
|
|
|
|
echo "post pack dir:"
|
|
|
|
ls
|
2020-02-10 17:15:16 +03:00
|
|
|
- name: yarn audit
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
2020-02-09 19:03:42 +03:00
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: |
|
2020-02-10 17:15:16 +03:00
|
|
|
echo "# Yarn Audit Results" | tee -a ${{runner.workspace }}/notes.md
|
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-10 02:32:40 +03:00
|
|
|
yarn audit 2>&1 | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:15:16 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-09 19:03:42 +03:00
|
|
|
- name: Publish ${{ matrix.package.name }}
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
run: |
|
|
|
|
echo "# NPM Package Publish" | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:15:16 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-09 19:03:42 +03:00
|
|
|
npm publish 2>&1 | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:15:16 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-09 19:03:42 +03:00
|
|
|
- name: Create Release
|
|
|
|
id: create_npm_release
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
uses: jbolda/create-release@v1.1.0
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
|
|
|
|
release_name: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [npmjs.com]"
|
|
|
|
bodyFromFile: ./../notes.md
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
|
|
id: upload-release-asset
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2020-02-10 02:32:40 +03:00
|
|
|
upload_url: ${{ steps.create_npm_release.outputs.upload_url }}
|
2020-02-09 19:03:42 +03:00
|
|
|
asset_path: ./${{ matrix.package.path }}/${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.tgz
|
|
|
|
asset_name: ${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.tgz
|
|
|
|
asset_content_type: application/x-gtar
|
|
|
|
- name: Tangle Release
|
|
|
|
id: tangle_release
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
2020-02-21 17:42:37 +03:00
|
|
|
uses: iotaledger/gh-tangle-release@v0.6.0
|
2020-02-09 19:03:42 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
IOTA_SEED: ${{ secrets.IOTA_SEED }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
|
2020-02-10 17:15:16 +03:00
|
|
|
comment: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [npmjs.com]"
|