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
|
id: check
|
||||||
uses: https://git.lhprovedor.com.br/leandro/devops/.forgejo/actions/check-package-version@main
|
uses: https://git.lhprovedor.com.br/leandro/devops/.forgejo/actions/check-package-version@main
|
||||||
|
|
||||||
publish-to-npm:
|
publish: #
|
||||||
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:
|
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
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')
|
if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master')
|
||||||
steps:
|
steps:
|
||||||
- name: Download Artifact
|
- name: Publish Npm Packages
|
||||||
uses: actions/download-artifact@v3
|
uses: https://git.lhprovedor.com.br/leandro/devops/.forgejo/actions/publish-npm-package@main
|
||||||
with:
|
with:
|
||||||
path: dist
|
npm_token: ${{ secrets.NPM_TOKEN }}
|
||||||
name: dist
|
git_token: ${{ secrets.PACKAGE_PUBLISHER_TOKEN }}
|
||||||
|
git_username: ${{ leandro }}
|
||||||
- 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 }}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue