Skip to content

Commit fb466cd

Browse files
committed
GDL-9 publish npm package to registry
1 parent de5b316 commit fb466cd

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

.github/workflows/release.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag to be released'
8+
required: true
9+
10+
permissions:
11+
contents: write
12+
packages: write
13+
14+
jobs:
15+
check:
16+
name: preliminary-checks
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Ensure version is properly set
21+
run: |
22+
test "$(npm -s run get-version)" = "${{ inputs.tag }}"
23+
- name: Give user instruction
24+
if: failure()
25+
run: echo "::error file=package.json,line=6::The tag ${{ inputs.tag }} must match the version"
26+
publish-github:
27+
runs-on: ubuntu-latest
28+
needs: check
29+
steps:
30+
- uses: actions/checkout@v4
31+
# Setup .npmrc file to publish to GitHub Packages
32+
- uses: actions/setup-node@v4
33+
with:
34+
cache: yarn
35+
node-version: '16'
36+
registry-url: 'https://npm.pkg.github.com'
37+
- run: yarn install
38+
- run: yarn publish
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
publish-npm:
42+
runs-on: ubuntu-latest
43+
needs: check
44+
steps:
45+
- uses: actions/checkout@v4
46+
# Setup .npmrc file to publish to npmjs.org
47+
- uses: actions/setup-node@v4
48+
with:
49+
cache: yarn
50+
node-version: '16'
51+
registry-url: 'https://registry.npmjs.org'
52+
- run: yarn install
53+
- run: yarn publish
54+
env:
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
release-github:
57+
runs-on: ubuntu-latest
58+
needs:
59+
- publish-github
60+
- publish-npm
61+
steps:
62+
- name: Create Release
63+
uses: softprops/action-gh-release@v2
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
tag_name: ${{ inputs.tag }}
68+
name: Release ${{ inputs.tag }}
69+
target_commitish: ${{ github.sha }}

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "eslint-config-scality",
2+
"name": "@scality/guidelines",
33
"version": "7.10.2",
44
"description": "ESLint config for Scality's Node.js coding guidelines",
55
"bin": {
@@ -39,5 +39,8 @@
3939
"homepage": "https://github.com/scality/Guidelines",
4040
"engines": {
4141
"node": ">=16"
42+
},
43+
"publishConfig": {
44+
"access": "public"
4245
}
4346
}

0 commit comments

Comments
 (0)