Skip to content

Commit 7b44380

Browse files
ci: use release please to manage the release process (#213)
* chore: add dependabot * chore: remove old codeowners * ci: add gh action to validate pr format * ci: run openssf scorecard analysis with a reusable workflow * ci: add codeql gh action * ci: use release-please for the cd * chore: remove old scripts to generate releases
1 parent 773f560 commit 7b44380

13 files changed

+297
-162
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Please see the documentation for all configuration options:
2+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: 'npm'
7+
directory: '/'
8+
schedule:
9+
interval: 'weekly'
10+
11+
- package-ecosystem: 'github-actions' # See documentation for possible values
12+
directory: '/' # Location of package manifests
13+
schedule:
14+
interval: 'weekly'

.github/workflows/cd.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: 'CodeQL'
13+
14+
on:
15+
push:
16+
branches: ['main']
17+
pull_request:
18+
branches: ['main']
19+
schedule:
20+
- cron: '30 1 * * 0'
21+
workflow_dispatch:
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
# Runner size impacts CodeQL analysis time. To learn more, please see:
27+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
28+
# - https://gh.io/supported-runners-and-hardware-resources
29+
# - https://gh.io/using-larger-runners
30+
# Consider using larger runners for possible analysis time improvements.
31+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33+
permissions:
34+
# required for all workflows
35+
security-events: write
36+
37+
# only required for workflows in private repositories
38+
actions: read
39+
contents: read
40+
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
language: ['javascript-typescript']
45+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
46+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
47+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
48+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
49+
50+
steps:
51+
- name: 🔐 Harden Runner
52+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
53+
with:
54+
disable-sudo: true
55+
egress-policy: block
56+
allowed-endpoints: >
57+
api.github.com:443
58+
github.com:443
59+
objects.githubusercontent.com:443
60+
uploads.github.com:443
61+
62+
- name: ⚙️ Checkout code
63+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
64+
65+
- name: ⚙️ Initialize CodeQL
66+
uses: github/codeql-action/init@05963f47d870e2cb19a537396c1f668a348c7d8f # v3.24.8
67+
with:
68+
languages: ${{ matrix.language }}
69+
# If you wish to specify custom queries, you can do so here or in a config file.
70+
# By default, queries listed here will override any specified in a config file.
71+
# Prefix the list here with "+" to use these queries and those in the config file.
72+
73+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
74+
# queries: security-extended,security-and-quality
75+
76+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
77+
# If this step fails, then you should remove it and run the build manually (see below)
78+
- name: ⚙️ Autobuild
79+
uses: github/codeql-action/autobuild@05963f47d870e2cb19a537396c1f668a348c7d8f # v3.24.8
80+
81+
# ℹ️ Command-line programs to run using the OS shell.
82+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
83+
84+
# If the Autobuild fails above, remove it and uncomment the following three lines.
85+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
86+
87+
# - run: |
88+
# echo "Run, Build Application using script"
89+
# ./location_of_script_within_repo/buildscript.sh
90+
91+
- name: 🔎 Perform CodeQL Analysis
92+
uses: github/codeql-action/analyze@05963f47d870e2cb19a537396c1f668a348c7d8f # v3.24.8
93+
with:
94+
category: '/language:${{matrix.language}}'

.github/workflows/compliance.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Security compliance
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 1'
6+
push:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
permissions: read-all # Declare default permissions as read only.
12+
13+
jobs:
14+
scorecard:
15+
permissions:
16+
security-events: write
17+
id-token: write
18+
uses: onebeyond/reusable-workflows/.github/workflows/openssf-scorecard.yml@main

.github/workflows/openssf-scorecard.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release and publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions: {}
9+
10+
jobs:
11+
release-please:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write # to create release commit
15+
pull-requests: write # to create release PR
16+
17+
outputs:
18+
release_created: ${{ steps.release.outputs.release_created }}
19+
20+
steps:
21+
- name: 🔐 Harden Runner
22+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
23+
with:
24+
egress-policy: audit
25+
26+
- name: 🆕 Create or update release
27+
uses: google-github-actions/release-please-action@a37ac6e4f6449ce8b3f7607e4d97d0146028dc0b # 4.1.0
28+
id: release
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
32+
npm-publish:
33+
needs: [release-please]
34+
runs-on: ubuntu-latest
35+
permissions:
36+
id-token: write # to allow npm publish provenance generation
37+
38+
# this if statements ensure that a publication only occurs when a new release is created:
39+
if: ${{ needs.release-please.outputs.release_created }}
40+
41+
steps:
42+
- name: 🔐 Harden Runner
43+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
44+
with:
45+
disable-sudo: true
46+
egress-policy: block
47+
allowed-endpoints: >
48+
fulcio.sigstore.dev:443
49+
github.com:443
50+
registry.npmjs.org:443
51+
rekor.sigstore.dev:443
52+
53+
- name: 🔔 Checkout
54+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # 4.1.2
55+
56+
- name: ⚙️ Setup Node.js
57+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # 4.0.2
58+
with:
59+
node-version: 20
60+
registry-url: 'https://registry.npmjs.org'
61+
62+
- name: 📦 Install dependencies
63+
run: npm ci
64+
65+
- name: 🚀 Publish to npm
66+
run: npm publish
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_GUIDESMITHS }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Semantic Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
lint:
15+
name: Validate Pull Request title format
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: 🔐 Harden Runner
19+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
20+
with:
21+
disable-sudo: true
22+
egress-policy: block
23+
allowed-endpoints: >
24+
api.github.com:443
25+
26+
- name: 🔎 Validate Pull Request format
27+
uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
# Configure additional validation for the subject based on a regex.
32+
# This ensures the subject doesn't start with an uppercase character.
33+
subjectPattern: ^(?![A-Z]).+$
34+
# If `subjectPattern` is configured, you can use this property to override
35+
# the default error message that is shown when the pattern doesn't match.
36+
# The variables `subject` and `title` can be used within the message.
37+
subjectPatternError: |
38+
The subject "{subject}" found in the pull request title "{title}"
39+
didn't match the configured pattern. Please ensure that the subject
40+
doesn't start with an uppercase character.

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
provenance=true
2+
access=public
3+
ignore-scripts=true

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "2.0.0"
3+
}

0 commit comments

Comments
 (0)