Skip to content

Commit

Permalink
(ci): fix publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LoboMetalurgico committed Jul 6, 2022
1 parent 389fff9 commit 81543dd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/gitpublish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Publish Tag and Release

on:
push:
branches:
- main
workflow_run:
workflows: [Test]
types: [completed]
branches: [main]

jobs:
job1:
name: Publish Tag
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: "Refresh tags"
id: tag
id: refresh-tag
run: git fetch --tags --force
- id: set_var
name: Get Version
Expand All @@ -36,6 +38,7 @@ jobs:
needs: job1
name: Publish Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/packagePublish.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: Publish API to npmjs
name: Publish API to NPM and GPR

on:
release:
types: [created]
workflow_run:
workflows: [Test]
types: [completed]
branches: [main]

jobs:
build:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- name: Setup .npmrc
- name: Setup .npmrc (NPM)
uses: actions/setup-node@v3
with:
node-version: '12.x'
Expand All @@ -22,8 +25,6 @@ jobs:
- name: Install dependencies
working-directory: ./api
run: npm ci
- name: Copy .npmrc to api/out
run: cp .npmrc ./api/out
- name: Prepare to publish
working-directory: ./api
run: npm run pdeploy
Expand All @@ -32,3 +33,12 @@ jobs:
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup .npmrc (GPR)
uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com'
- name: Publish to GPR
working-directory: ./api/out
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 81543dd

Please sign in to comment.