diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml deleted file mode 100644 index 02f4da0..0000000 --- a/.github/workflows/on-release.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Package to npmjs -on: - release: - types: [created] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - scope: '@vocdoni' - - run: yarn - - run: yarn build - - run: yarn publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index de435b4..cfc2a3c 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -4,9 +4,10 @@ name: Post merge build step on: push: branches: - - master - pull_request: - + - master + tags: + - '*' + pull_request: ~ jobs: protobuf-build: runs-on: ubuntu-latest @@ -28,3 +29,21 @@ jobs: commit_message: auto build commit env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if tag + id: check_tag + run: | + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + echo "is_tag=true" >> $GITHUB_ENV + else + echo "is_tag=false" >> $GITHUB_ENV + fi + + - name: Publish to npm + if: env.is_tag == 'true' + run: | + yarn + yarn build + yarn publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/DEVELOPING.md b/DEVELOPING.md index cf793b1..4f9c907 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -79,8 +79,5 @@ order to minimize the work. Just follow these steps: - Commit the changes: `git commit package.json -m "@vocdoni/proto 1.2.3"` - Tag the commit: `git tag v1.2.3` - Push the ref and the tag: `git push origin master v1.2.3` -- Create a new github release: https://github.com/vocdoni/dvote-protobuf/releases/new?tag=v1.2.3 -As soon as the github release is done, the github action will take care of the rest automatically: build the npm package and publish it on https://www.npmjs.com/package/@vocdoni/proto - -TODO(gui): automate the release creation step, using the github action, triggered by the push of a tag \ No newline at end of file +The publish to npmjs should be triggered by GH actions as soon as the new tag is detected. \ No newline at end of file