Skip to content

Commit

Permalink
Updated pipeline to publish dev or beta tag (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elmar Kenigs authored Nov 14, 2022
1 parent 41cb2ab commit f532eeb
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
cache: 'npm'

- run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🛠️ Build
run: npm run build
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
cache: 'npm'

- run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🛠️ Build
run: npm run build
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
cache: 'npm'

- run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🧪 Run linter
run: npm run lint
42 changes: 32 additions & 10 deletions .github/workflows/publish-beta-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ on:
options:
- dev
- beta
package:
description: 'packages'
required: true
default: 'all'
type: choice
options:
- all
- config
- sdk
- utils
- transact

jobs:
publish-beta-dev:
runs-on: ubuntu-latest
Expand All @@ -24,28 +36,38 @@ jobs:
node-version: 16.x
cache: 'npm'

- name: 🔐 Authenticate with NPM
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🛠️ Build
run: npm run build

- name: Get last version number
run: echo "last_version_number=$(npm show @moonbeam-network/xcm-sdk dist-tags.${{ inputs.tag }} | grep -Eo '[0-9]+$')" >> $GITHUB_ENV
- name: Increase version number
run: echo "new_version_number=$((${{ env.last_version_number }}+1))" >> $GITHUB_ENV
- name: Get new version
run: echo "new_version=0.0.1-${{ inputs.tag }}.${{ env.new_version_number }}" >> $GITHUB_ENV
- name: 🚀 Publish utils
if: inputs.package == 'all' || inputs.package == 'utils'
working-directory: ./packages/utils
run: |
npm version $(../../scripts/get_next_version.sh xcm-utils ${{ inputs.tag }}) --no-git-tag-version
npm publish --tag ${{ inputs.tag }}
- name: 🚀 Publish config
if: inputs.package == 'all' || inputs.package == 'config'
working-directory: ./packages/config
run: |
npm version ${{ env.new_version }} --no-git-tag-version
npm version $(../../scripts/get_next_version.sh xcm-config ${{ inputs.tag }}) --no-git-tag-version
npm publish --tag ${{ inputs.tag }}
- name: 🚀 Publish sdk
if: inputs.package == 'all' || inputs.package == 'sdk'
working-directory: ./packages/sdk
run: |
npm version ${{ env.new_version }} --no-git-tag-version
npm version $(../../scripts/get_next_version.sh xcm-sdk ${{ inputs.tag }}) --no-git-tag-version
npm publish --tag ${{ inputs.tag }}
- name: 🚀 Publish transact
if: inputs.package == 'all' || inputs.package == 'transact'
working-directory: ./packages/transact
run: |
npm version $(../../scripts/get_next_version.sh xcm-transact ${{ inputs.tag }}) --no-git-tag-version
npm publish --tag ${{ inputs.tag }}
2 changes: 0 additions & 2 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
cache: 'npm'

- run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🧪 Run unit tests
run: npm run test:ci
5 changes: 5 additions & 0 deletions scripts/get_next_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
last_version_number=$(npm show @moonbeam-network/$1 dist-tags.$2 | grep -Eo '[0-9]+$')
new_version_number=$(($last_version_number+1))
new_version=0.0.1-$2.$new_version_number

echo $new_version

0 comments on commit f532eeb

Please sign in to comment.