diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index e4d8d51..c7bd222 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -73,12 +73,12 @@ jobs: echo "version_changed=false" >> "$GITHUB_OUTPUT" fi - publish-staging: + publish-to-npm: runs-on: docker needs: [mirror] container: image: node:20-alpine - if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/heads/release-no-verify/')) + if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master') steps: - name: Download lhmask uses: actions/download-artifact@v3 @@ -86,6 +86,10 @@ jobs: path: lhmask name: lhmask + - name: Ajusta nome do pacote + if: github.ref == 'refs/heads/master' + run: sed -i "s/-dev//g" lhmask/package.json + - name: Publish to NPM (staging) run: | cd lhmask @@ -93,45 +97,24 @@ jobs: npm publish env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - publish-production: - runs-on: docker - needs: [mirror] - container: - image: node:20-alpine - if: needs.check-version.outputs.version_changed == 'true' && github.ref == 'refs/heads/master' - steps: - - name: Download lhmask - uses: actions/download-artifact@v3 - with: - path: lhmask - name: lhmask - - name: Publish to NPM (staging) - run: | - cd lhmask - sed -i "s/-dev//g" package.json - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - npm publish - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - publish-git: + publish-to-git: runs-on: docker container: image: node:20-alpine needs: [build-and-test] - if: needs.check-version.outputs.version_changed == 'true' + if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master') steps: - name: Download lhmask uses: actions/download-artifact@v3 with: path: lhmask name: lhmask + - name: Ajusta nome do pacote if: github.ref == 'refs/heads/master' - run: | - cd lhmask - sed -i "s/-dev//g" package.json + run: sed -i "s/-dev//g" lhmask/package.json + - name: Publish to Git run: | npm config set registry https://git.lhprovedor.com.br/api/packages/leandro/npm/ @@ -143,11 +126,8 @@ jobs: finish: runs-on: docker - needs: [publish-staging, publish-production, publish-git, build-and-test] + needs: [build-and-test, publish-to-npm, publish-to-git] container: image: node:20-alpine steps: - - name: Finish task - run: echo Done - - name: Publish to Git - run: npm publish + - run: echo Done