feat: using publish-npm-package
This commit is contained in:
parent
049d0d16d9
commit
d3cd9b28df
1 changed files with 7 additions and 44 deletions
|
@ -56,53 +56,16 @@ jobs:
|
|||
id: check
|
||||
uses: https://git.lhprovedor.com.br/leandro/devops/.forgejo/actions/check-package-version@main
|
||||
|
||||
publish-to-npm:
|
||||
runs-on: docker
|
||||
needs: [build-and-test, check-version]
|
||||
container:
|
||||
image: node:20-alpine
|
||||
if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master')
|
||||
steps:
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: dist
|
||||
name: dist
|
||||
|
||||
- name: Ajusta nome do pacote
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: sed -i "s/-dev//g" dist/package.json
|
||||
|
||||
- name: Publish to NPM (staging)
|
||||
run: |
|
||||
cd dist
|
||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
||||
npm publish
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
publish-to-git:
|
||||
publish: #
|
||||
runs-on: docker
|
||||
container:
|
||||
image: node:20-alpine
|
||||
needs: [build-and-test, check-version]
|
||||
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 Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
- name: Publish Npm Packages
|
||||
uses: https://git.lhprovedor.com.br/leandro/devops/.forgejo/actions/publish-npm-package@main
|
||||
with:
|
||||
path: dist
|
||||
name: dist
|
||||
|
||||
- name: Ajusta nome do pacote
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: sed -i "s/-dev//g" dist/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
|
||||
npm publish
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.PACKAGE_PUBLISHER_TOKEN }}
|
||||
npm_token: ${{ secrets.NPM_TOKEN }}
|
||||
git_token: ${{ secrets.PACKAGE_PUBLISHER_TOKEN }}
|
||||
git_username: ${{ leandro }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue