Skip to content

Github Action for creating .npmrc file and connecting to azure dev ops feed / npm registry

License

Notifications You must be signed in to change notification settings

MassivDash/ado-npmrc-ts-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

📦 Azure Dev Ops .npmrc maker github action

Version Documentation License: MIT Twitter: SpaceoutPl

GitHub Super-LinterCICompliationCodeCoverage

Platforms

windows linux macOs

This action will create a .npmrc file with authorization needed to access Azure Dev Ops internal npm registry / feed. Works on all github OS machines (Windows, Linux, MacOS)

Minimal node version

Static Badge

registry=https://pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/registry/
always-auth=true
; begin auth token
//pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/registry/:username=AZURE_USERNAME
//pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/registry/:_password=AZURE_PASSWORD
//pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/registry/:email=AZURE_EMAIL
//pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/:username=AZURE_USERNAME
//pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/:_password=AZURE_PASSWORD
//pkgs.dev.azure.com/AZURE_ORGANIZATION/_packaging/AZURE_REGISTRY_NAME/npm/:email=AZURE_EMAIL
; end auth token

*action works with project based feeds aswell

Works on all OS types (mac, windows, linux) with node >= 20.0.0 setup


Prerequisites

  • Azure Dev Ops npm registry
  • Azure PAT token

Variables

Variable Description Required Example Type
AZURE_PASSWORD Azure Dev Ops PAT token encoded as BASE64 string or "pure" PAT Yes BASE64_STRING string
AZURE_REGISTRY_NAME Name of the registry Yes Upstream string
AZURE_ORGANIZATION Name of your ADO organization Yes Org string
AZURE_PROJECT NAME of your Project (optional) No Project string
AZURE_USERNAME Name of the user, usually the same as ORG No ORG string
AZURE_EMAIL Email of the user, creator of the AZURE_PASSWORD Yes [email protected] string
AZURE_REGISTRY_SCOPE Scope for the registry (optional) No @your-org string
AZURE_ENCODE_PASSWORD Indicates if the AZURE_PASSWORD is encoded as BASE64 string or "pure" PAT, optional No false boolean

Usage

Here's an example of how to use this action in a workflow file:

name: Example Workflow
on:
  workflow_dispatch:
    inputs:
      inputs:
        AZURE_PASSWORD:
          description:
            'Azure Dev Ops PAT token encoded as BASE64 string or "pure" PAT'
          required: true
          default: ''
          type: string
        AZURE_REGISTRY_NAME:
          description: 'Name of the registry'
          required: true
          default: 'Upstream'
          type: string
        AZURE_ORGANIZATION:
          description: 'Name of your ADO organization'
          required: true
          default: 'Org'
          type: string
        AZURE_PROJECT:
          description: 'NAME of your Project (optional)'
          required: false
          default: 'Project'
          type: string
        AZURE_USERNAME:
          description: 'Name of the user, usually the same as ORG'
          required: false
          default: 'ORG'
          type: string
        AZURE_EMAIL:
          description: 'Email of the user, creator of the AZURE_PASSWORD'
          required: true
          default: '[email protected]'
          type: string
        AZURE_REGISTRY_SCOPE:
          description: 'Scope for the registry (optional)'
          required: false
          default: '@your-org'
          type: string
        AZURE_ENCODE_PASSWORD:
          description:
            'Indicates if the AZURE_PASSWORD is encoded as BASE64 string or
            "pure" PAT, optional'
          required: false
          default: false
          type: boolean

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest

    steps:
      # Change @main to a specific commit SHA or version tag, e.g.:
      # MassivDash/ado-npmrc-ts-action@e76147da8e5c81eaf017dede5645551d4b94427b
      # MassivDash/[email protected]

      - name: Create a Azure Dev Ops .npmrc file
        id: ado-npmrc
        uses: MassivDash/[email protected]
        with:
          AZURE_PASSWORD: { { secrets.AZURE_PASSWORD } }
          AZURE_REGISTRY_NAME: 'registry'
          AZURE_USERNAME: 'username'
          AZURE_ORGANIZATION: 'organization'
          AZURE_EMAIL: '[email protected]'

spaceout.pl

Luke Celitan, Spaceghost

x: [@Spaceout.pl] https://spaceout.pl

About

Github Action for creating .npmrc file and connecting to azure dev ops feed / npm registry

Resources

License

Stars

Watchers

Forks

Packages

No packages published