Skip to content

Commit 00ec723

Browse files
authored
ARGG-945 Setup publishing (#2)
* Add actions * Add .nvmrc
1 parent 1c8b2e3 commit 00ec723

File tree

8 files changed

+270
-0
lines changed

8 files changed

+270
-0
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
time: '10:00'
8+
open-pull-requests-limit: 10
9+
versioning-strategy: increase
10+
ignore:
11+
- dependency-name: '*'
12+
update-types: ['version-update:semver-patch']

.github/release-drafter.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name-template: '$RESOLVED_VERSION'
2+
tag-template: '$RESOLVED_VERSION'
3+
categories:
4+
- title: 'Breaking'
5+
label: 'major'
6+
- title: 'Added'
7+
label: 'minor'
8+
- title: 'Fixed'
9+
label: 'patch'
10+
- title: 'Dependency updates'
11+
label: 'dependencies'
12+
exclude-labels:
13+
- 'skip-changelog'
14+
- 'github_actions'
15+
version-resolver:
16+
major:
17+
labels:
18+
- 'major'
19+
minor:
20+
labels:
21+
- 'minor'
22+
patch:
23+
labels:
24+
- 'patch'
25+
- 'dependencies'
26+
default: patch
27+
template: |
28+
## What’s Changed
29+
$CHANGES

.github/workflows/_test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
defaults:
7+
run:
8+
shell: bash -l {0}
9+
10+
env:
11+
CACHE_NAME: node-modules-cache
12+
13+
jobs:
14+
Test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version-file: '.nvmrc'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Restore Cache
25+
uses: actions/cache/restore@v3.3.1
26+
id: npm-cache
27+
with:
28+
path: |
29+
node_modules/
30+
key: ${{ env.CACHE_NAME }}-${{ hashFiles('package-lock.json') }}
31+
32+
- name: Run linters
33+
run: npm run lint
34+
35+
- name: Test
36+
run: npm test

.github/workflows/label-check.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: label-check
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, labeled, unlabeled, synchronize]
6+
7+
jobs:
8+
label-check:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: docker://agilepathway/pull-request-label-checker:latest
13+
with:
14+
one_of: major,minor,patch,skip-changelog
15+
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash -l {0}
14+
15+
env:
16+
CACHE_NAME: node-modules-cache
17+
18+
jobs:
19+
Create-NPM-Cache:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version-file: '.nvmrc'
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: Upload to Cache
30+
uses: actions/cache@v3.3.1
31+
id: npm-cache
32+
with:
33+
path: |
34+
node_modules/
35+
key: ${{ env.CACHE_NAME }}-${{ hashFiles('package-lock.json') }}
36+
37+
- name: Install dependencies
38+
if: ${{ steps.npm-cache.outputs.cache-hit != 'true' }}
39+
run: npm ci
40+
41+
Run-Tests:
42+
permissions:
43+
statuses: write
44+
pull-requests: write
45+
needs: [Create-NPM-Cache]
46+
uses: ./.github/workflows/_test.yml
47+
48+
ReleaseDraft:
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: write
52+
pull-requests: read
53+
steps:
54+
- name: Draft release notes
55+
uses: release-drafter/release-drafter@v5
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash -l {0}
14+
15+
env:
16+
CACHE_NAME: node-modules-cache
17+
18+
jobs:
19+
Create-NPM-Cache:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version-file: '.nvmrc'
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: Upload to Cache
30+
uses: actions/cache@v3.3.1
31+
id: npm-cache
32+
with:
33+
path: |
34+
node_modules/
35+
key: ${{ env.CACHE_NAME }}-${{ hashFiles('package-lock.json') }}
36+
37+
- name: Install dependencies
38+
if: ${{ steps.npm-cache.outputs.cache-hit != 'true' }}
39+
run: npm ci
40+
41+
Run-Tests:
42+
permissions:
43+
statuses: write
44+
pull-requests: write
45+
needs: [Create-NPM-Cache]
46+
uses: ./.github/workflows/_test.yml

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
defaults:
8+
run:
9+
shell: bash -l {0}
10+
11+
env:
12+
CACHE_NAME: node-modules-cache
13+
14+
jobs:
15+
Create-NPM-Cache:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version-file: '.nvmrc'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Upload to Cache
26+
uses: actions/cache@v3.3.1
27+
id: npm-cache
28+
with:
29+
path: |
30+
node_modules/
31+
key: ${{ env.CACHE_NAME }}-${{ hashFiles('package-lock.json') }}
32+
33+
- name: Install dependencies
34+
if: ${{ steps.npm-cache.outputs.cache-hit != 'true' }}
35+
run: npm ci
36+
37+
Run-Tests:
38+
permissions:
39+
statuses: write
40+
pull-requests: write
41+
needs: [Create-NPM-Cache]
42+
uses: ./.github/workflows/_test.yml
43+
44+
Release:
45+
name: Release @skyscanner/eslint-plugin-backpack to NPM
46+
runs-on: ubuntu-latest
47+
environment: Publishing
48+
needs: [Create-NPM-Cache, Run-Tests]
49+
steps:
50+
- name: Checkout source code
51+
uses: actions/checkout@v3
52+
with:
53+
ref: main
54+
55+
- uses: actions/setup-node@v3
56+
with:
57+
node-version-file: '.nvmrc'
58+
registry-url: 'https://registry.npmjs.org'
59+
60+
- name: Restore Cache
61+
uses: actions/cache/restore@v3.3.1
62+
id: npm-cache
63+
with:
64+
path: |
65+
node_modules/
66+
key: ${{ env.CACHE_NAME }}-${{ hashFiles('package-lock.json') }}
67+
68+
- name: Publish NPM package
69+
run: |
70+
npm version $RELEASE_VERSION --no-git-tag-version
71+
npm publish
72+
env:
73+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
74+
RELEASE_VERSION: ${{ github.event.release.tag_name }}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/hydrogen

0 commit comments

Comments
 (0)