diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..8bacd35 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,48 @@ +name: Publish Library +run-name: Publish Library + +on: + push: + +jobs: + build: + name: Build NPM Project + runs-on: ubuntu-latest + container: node:alpine + steps: + - name: Clone Repository + uses: ztimson/actions/clone@develop + + - name: Install & Build + run: npm i && npm run build + + - name: Publish Library + run: | + if [ "${{github.ref_name}}" = "master" ]; then + REGISTRY="${{github.server_url}}/api/packages/${{github.repository_owner}}/npm/" + npm set registry "$REGISTRY" + npm set $(echo $REGISTRY | sed s%http:%% | sed s%https:%% ):_authToken "${{secrets.DEPLOY_TOKEN}}" + npm publish || echo "Failed to publish" + + REGISTRY="https://registry.npmjs.org/" + npm set registry "$REGISTRY" + npm set $(echo $REGISTRY | sed s%http:%% | sed s%https:%% ):_authToken "${{secrets.NPM_TOKEN}}" + npm publish || echo "Failed to publish" + fi + tag: + name: Tag Version + needs: build + if: ${{github.ref_name}} == 'release' + runs-on: ubuntu-latest + container: node:alpine + steps: + - name: Clone Repository + uses: ztimson/actions/clone@develop + + - name: Get Version Number + run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV + + - name: Tag Version + uses: ztimson/actions/tag@develop + with: + tag: ${{env.VERSION}} diff --git a/README.md b/README.md index 471df75..2bd3546 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
- Logo + Logo ### Zim Utils