diff --git a/.drone-1.0.yml b/.drone-1.0.yml deleted file mode 100644 index b2b203e..0000000 --- a/.drone-1.0.yml +++ /dev/null @@ -1,35 +0,0 @@ - -kind: pipeline -name: default -type: kubernetes -steps: - - name: install - image: node:18 - environment: - NPM_AUTH_USERNAME: - from_secret: npm_auth_username - NPM_AUTH_TOKEN: - from_secret: npm_auth_token - commands: - - npm ci - - name: test - image: node:18 - environment: - NPM_AUTH_USERNAME: - from_secret: npm_auth_username - NPM_AUTH_TOKEN: - from_secret: npm_auth_token - commands: - - npm test - - name: publish - image: node:18 - environment: - NPM_AUTH_USERNAME: - from_secret: npm_auth_username - NPM_AUTH_TOKEN: - from_secret: npm_auth_token - commands: - - npm publish - when: - event: - - tag diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..54af01b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,28 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "⬆️ " + pull-request-branch-name: + separator: "-" + reviewers: + - "UKHomeOffice/asl-devs" + labels: + - "skip-release" + - "dependencies" + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "⬆️ " + pull-request-branch-name: + separator: "-" + reviewers: + - "UKHomeOffice/asl-devs" + labels: + - "patch" + - "dependencies" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..e9d5363 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,39 @@ +name: "CodeQL Scan" +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '45 12 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..3169f90 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,9 @@ +name: 'Publish - npm' +on: + pull_request: + types: [ closed ] + +jobs: + publish: + uses: UKHomeOffice/sas-github-workflows/.github/workflows/publish-npm.yml@v1 + secrets: inherit diff --git a/.github/workflows/semver-check-increment-npm.yml b/.github/workflows/semver-check-increment-npm.yml new file mode 100644 index 0000000..f6368e9 --- /dev/null +++ b/.github/workflows/semver-check-increment-npm.yml @@ -0,0 +1,8 @@ +name: 'Increment Version - npm' +on: + pull_request: + types: [ labeled, unlabeled, opened, reopened, synchronize ] + +jobs: + version: + uses: UKHomeOffice/sas-github-workflows/.github/workflows/semver-check-increment-npm.yml@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..051c7ce --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,9 @@ +name: 'Test' +on: + pull_request: + types: [ opened, reopened, synchronize ] + +jobs: + test: + uses: UKHomeOffice/sas-github-workflows/.github/workflows/test-npm.yml@v1 + secrets: inherit diff --git a/.npmrc b/.npmrc index f4258eb..42792e8 100644 --- a/.npmrc +++ b/.npmrc @@ -1,6 +1,2 @@ -@asl:registry = https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/ - -//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:username=${NPM_AUTH_USERNAME} -//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:_password=${NPM_AUTH_TOKEN} -//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:email=leonard.martin@digital.homeoffice.gov.uk -//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:always-auth=true +@ukhomeoffice:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} diff --git a/README.md b/README.md index edfb7c2..a6d18fb 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,20 @@ Expansions of acronyms commonly used in ASL projects - ## Usage +[Authenticate with GitHub packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token) + Install the package: ```bash -npm install @asl/dictionary --save-prod +npm install @ukhomeoffice/asl-dictionary --save-prod ``` Import as necessary: ```js -const dictionary = require('@asl/dictionary'); +const dictionary = require('@ukhomeoffice/asl-dictionary'); console.log(dictionary.NACWO); ``` @@ -22,3 +23,11 @@ result: ```bash Named Animal Care and Welfare Officer ``` + +## Publishing + +This is automatically published to the GitHub packages npm repository using GitHub Actions. + +When opening a pull request add a label `major`, `minor` or `patch` (or `skip-release`) and the version field in package.json will be updated by the pipeline using `npm version`. + +It is published once the pull request is merged if there is no `skip-release` label on the pull request, the SHA is also tagged with the SemVer value at that point. diff --git a/package.json b/package.json index fc43a84..4325998 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,13 @@ { - "name": "@asl/dictionary", - "version": "1.1.5", + "name": "@ukhomeoffice/asl-dictionary", + "version": "2.0.0", "description": "Expansions of acronyms commonly used in ASL projects", "main": "index.js", "scripts": { - "test": "eslint ." + "build": "exit 0", + "test": "exit 0", + "lint": "eslint .", + "audit": "npm audit" }, "repository": { "type": "git", @@ -18,7 +21,7 @@ }, "homepage": "https://github.com/UKHomeOffice/asl-dictionary#readme", "publishConfig": { - "registry": "https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/" + "@ukhomeoffice:registry": "https://npm.pkg.github.com" }, "devDependencies": { "eslint": "^8.27.0"