Skip to content

Commit

Permalink
Feature - move from drone to gha (#48)
Browse files Browse the repository at this point in the history
* ported gha publishing workflow
* updated publish repo to private home office from public npm - this is because the @UKHomeOffice namespace exists in both registries so we cannot install from both in the same context
  • Loading branch information
joefitter authored May 2, 2023
1 parent 2e34cf2 commit 655914b
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 26 deletions.
23 changes: 0 additions & 23 deletions .drone-1.0.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
"env": {
"node": true,
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": "eslint:recommended",
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
}
}
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
39 changes: 39 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "CodeQL Scan"
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
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}}"
9 changes: 9 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions .github/workflows/semver-check-increment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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
with:
mainLineBranchName: master
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ HTML components are shipped as nunjucks macro functions for maximal compatabilit

### 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)

To use a component inside a nunjucks template, first import the component, then call as a function:

```
Expand Down Expand Up @@ -87,3 +89,11 @@ A number of colour variables are defined in sass as shortcuts
* <img src="./docs/images/colours/ho-link-visited.svg" width="20" height="20" /> `$ho-link-visited` - `#4C2C92`
* <img src="./docs/images/colours/ho-link-hover.svg" width="20" height="20" /> `$ho-link-hover` - `#2B8CC4` (alias `$ho-link-active`)
* <img src="./docs/images/colours/ho-link-focus.svg" width="20" height="20" /> `$ho-link-focus` - `#005798`

## 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.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@ukhomeoffice/frontend-toolkit",
"version": "2.13.1",
"version": "3.0.0",
"description": "Implementation of github.com/UKHomeOffice/design-system for use in projects",
"main": "index.js",
"styles": "./assets/styles/index.scss",
"scripts": {
"test": "npm run test:lint",
"test:lint": "sass-lint --max-warnings=0 --no-exit --verbose"
"test:lint": "sass-lint --max-warnings=0 --no-exit --verbose",
"build": "echo noop"
},
"repository": {
"type": "git",
Expand All @@ -29,6 +30,6 @@
"govuk-frontend": "^1.3.0"
},
"publishConfig": {
"access": "public"
"@ukhomeoffice:registry": "https://npm.pkg.github.com"
}
}

0 comments on commit 655914b

Please sign in to comment.