diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 350c58e..c7bd222 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -73,34 +73,12 @@ jobs: echo "version_changed=false" >> "$GITHUB_OUTPUT" fi - mirror: - runs-on: docker - needs: [build-and-test, check-version] - container: - image: node:20-alpine - steps: - - name: Instalando dependencias - run: | - apk add git - - - name: Checkout código - uses: actions/checkout@v4 - with: - fetch-depth: 0 # ✅ clone completo - - - name: Push para o repositório espelho - run: | - git remote add bitbucket https://leandro_costa:${BITBUCKET_TOKEN}@bitbucket.org/leandro_costa/lhmask.git - git push --force bitbucket HEAD - env: - BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }} - - 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 @@ -108,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 @@ -115,12 +97,13 @@ jobs: npm publish env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - publish-production: + + publish-to-git: runs-on: docker - needs: [mirror] container: image: node:20-alpine - if: needs.check-version.outputs.version_changed == 'true' && github.ref == 'refs/heads/master' + needs: [build-and-test] + 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 @@ -128,19 +111,23 @@ jobs: path: lhmask name: lhmask - - name: Publish to NPM (staging) + - name: Ajusta nome do pacote + if: github.ref == 'refs/heads/master' + 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/ + npm config set -- '//git.lhprovedor.com.br/api/packages/leandro/npm/:_authToken' "${NPM_TOKEN}" 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 }} + NPM_TOKEN: ${{ secrets.PACKAGE_PUBLISHER_TOKEN }} finish: runs-on: docker + needs: [build-and-test, publish-to-npm, publish-to-git] container: image: node:20-alpine steps: - - name: Finish task - run: echo Done + - run: echo Done diff --git a/package.json b/package.json index 7a1dd7b..1ea122a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "repository": { "type": "git", - "url": "git+ssh://git@bitbucket.org/leandro_costa/lhmask.git" + "url": "https://git.lhprovedor.com.br/leandro/lhmask.git" }, "keywords": [], "author": "",