This github action generates a .npmrc
file for Azure DevOps
- uses: ponicode/azure-devops-npm-action@master
with:
organisation: "Ponicode"
project: "my_project"
registry: "my_registry"
user: "unicorn"
password: ${{ secrets.AZURE_TOKEN }}
email: "unicorn@ponicode.com"
scope: "ponicode"
Go to the root of your project, and create the path to your workflow file. For example
mkdir -p .github/workflows
Here is an example of what to put in your .github/workflows/publish-npm.yml
file to trigger the action.
name: Publish on Azure NPM registry
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ponicode/azure-devops-npm-action@master
with:
organisation: ponicode_org
project: my_project
registry: my_npm_registry
user: unicorn
password: ${{ secrets.AZURE_TOKEN }}
email: unicorn@ponicode.com
scope: ponicode
- run: cp `pwd`/.npmrc ~ # We need the .npmrc file in the $HOME directory
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Publish to Azure
run: npm publish
This yaml file build and publish your project everytime you push on master
Go to Azure DevOps to generate a new token. More imformation on the offical documentation. Once your token is correctly base64 encoded, you can had it to your github secrets by following these steps:
- Open your project on Github
- Click on Settings
- Click on Secrets
- Click on New Secret
- Name: AZURE_TOKEN, Value: (Paste your token from Azure)
That's it! Once this is done, the action will be triggered on every push to master.
Name | Description | Required |
---|---|---|
organisation |
Your Azure organisation | true |
project |
Your Azure project | false |
registry |
Your Azure registry | true |
user |
Your Azure user | true |
password |
Your Azure password | true |
email |
Your Azure email | true |
encode_password |
Encode the given password to base64 (default: false) | false |
scope |
Your Azure scope | false |
We would love to hear your feedback! Tell us what you loved and what you want us to improve about this action at feedback@ponicode.com, or feel free to open a Github Issue.
We also have a Slack community channel, where people can ask for help if they encounter problems with our products and where we keep you informed about our latest releases.
If you want to know more about Ponicode and the different services we propose, check out our website www.ponicode.com!