Skip to content

Commit a09db85

Browse files
committed
ci: Add Puiblish workflows
1 parent d3f283b commit a09db85

File tree

3 files changed

+100
-2
lines changed

3 files changed

+100
-2
lines changed

.github/workflows/npm-publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
publish:
14+
name: Publish to NPM
15+
runs-on: ubuntu-latest
16+
environment: NPM
17+
permissions:
18+
contents: read
19+
statuses: write
20+
steps:
21+
- name: Set commit status to PENDING
22+
uses: myrotvorets/set-commit-status-action@243b4f7e597f62335408d58001edf8a02cf3e1fd # v1.1.7
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
status: pending
26+
context: Publish to NPM
27+
sha: ${{ github.sha }}
28+
29+
- name: Checkout source
30+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
31+
with:
32+
ref: ${{ github.event.release.tag_name }}
33+
34+
- name: Set up Node.js environment
35+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
36+
with:
37+
node-version: lts/*
38+
cache: npm
39+
registry-url: https://registry.npmjs.org/
40+
41+
- name: Publish package
42+
run: npm publish
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
46+
- name: Set final commit status
47+
uses: myrotvorets/set-commit-status-action@243b4f7e597f62335408d58001edf8a02cf3e1fd # v1.1.7
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
status: ${{ job.status }}
51+
context: Publish to NPM
52+
sha: ${{ github.sha }}

.github/workflows/push-tag.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Pre-release Testing
2+
3+
on:
4+
push:
5+
tags:
6+
- "v**"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
name: Build and test
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Install libmodsecurity
17+
run: |
18+
sudo apt-get update -y
19+
sudo apt-get install -y libmodsecurity-dev
20+
21+
- name: Check out the code
22+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
23+
24+
- name: Set up Node.js environment
25+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
26+
with:
27+
node-version: lts/*
28+
cache: npm
29+
30+
- name: Install dependencies and test
31+
run: npm cit
32+
33+
release:
34+
name: Prepare the release
35+
runs-on: ubuntu-latest
36+
needs: build
37+
permissions:
38+
contents: write
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
42+
43+
- name: Create a release
44+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
45+
with:
46+
generate_release_notes: true
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.REPOSITORY_ACCESS_TOKEN }}

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ As of the time of writing, libmodsecurity 3.0.9 seems to be OK: my tests did not
4545

4646
## Installation
4747

48-
(TBD; the library has not been published to NPM yet)
49-
5048
```sh
5149
npm install modsecurity
5250
```

0 commit comments

Comments
 (0)