Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.0.0 #34

Merged
merged 15 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintrc.d.mts

This file was deleted.

59 changes: 0 additions & 59 deletions .eslintrc.mjs

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: latest

Expand All @@ -21,12 +21,12 @@ jobs:
# pnpm dependencies cannot be cached until pnpm is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: pnpm

- name: Update dependencies
run: pnpm install
run: pnpm install --frozen-lockfile --strict-peer-dependencies

- name: build
run: pnpm run build.debug
- name: Build
run: pnpm run build
44 changes: 44 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Source: https://github.com/contributor-assistant/github-action
name: "CLA Assistant"
on:
issue_comment:
types: [ created ]
pull_request_target:
types: [ opened,closed,synchronize ]

# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
permissions:
actions: write
contents: write
pull-requests: write
statuses: write

jobs:
CLAAssistant:
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
uses: contributor-assistant/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
# This token is required only if you have configured to store the signatures in a remote repository/organization
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ACCESS_TOKEN }}
with:
path-to-signatures: 'cla/version1/signatures/cla.json'
path-to-document: 'https://github.com/cowwoc/requirements.js/blob/master/cla/version1/cla.md' # e.g. a CLA or a DCO document
# branch should not be protected
branch: 'main'
allowlist: cowwoc

# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
#signed-commit-message: 'For example: $contributorName has signed the CLA in $owner/$repo#$pullRequestNo'
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
#use-dco-flag: true - If you are using DCO instead of CLA
138 changes: 138 additions & 0 deletions .github/workflows/deploy_to_npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Deploy to npm
on:
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
open-release:
runs-on: ubuntu-latest
outputs:
INITIAL_MASTER_POSITION: ${{ steps.create-tag.outputs.INITIAL_MASTER_POSITION }}
INITIAL_GH_PAGES_POSITION: ${{ steps.create-tag.outputs.INITIAL_GH_PAGES_POSITION }}
TAG: ${{ steps.create-tag.outputs.TAG }}
VERSION: ${{ steps.create-tag.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Configure Git User
run: |
git config user.email "[email protected]"
git config user.name "Gili Tzabari"

# Getting the current git tag: https://stackoverflow.com/a/50465671/14731
#
# Setting a GitHub Action output parameter:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
# Extracting the release version number: https://stackoverflow.com/a/16623897/14731
- name: Create tag
id: create-tag
run: |
echo "INITIAL_MASTER_POSITION=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
./mvnw release:prepare --batch-mode -V -e
TAG=$(git describe --tag --abbrev=0)
echo "TAG=${TAG}" >> "$GITHUB_OUTPUT"
echo "VERSION=${TAG#"release-"}" >> "$GITHUB_OUTPUT"

deploy:
name: Deploy
needs: open-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.open-release.outputs.TAG }}
token: ${{ secrets.WORKFLOW_TOKEN }}
fetch-depth: 0

- name: Install node
uses: actions/setup-node@v4
with:
node-version: latest
registry-url: "https://registry.npmjs.org"

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate

# pnpm dependencies cannot be cached until pnpm is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: pnpm

- name: Test build
run: pnpm run build

- name: Deploy to npm
run: |
cd target\publish
copy ..\..\pnpm-lock.yaml .
pnpm publish --provenance --access=public

mkdir --parents "${{ needs.open-release.outputs.VERSION }}/docs"
mv target/reports/apidocs "${{ needs.open-release.outputs.VERSION }}/docs/api"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Cleanup on failure: https://stackoverflow.com/a/74562058/14731
on-failure:
needs: [ open-release, deploy ]
runs-on: ubuntu-latest
if: ${{ failure() || cancelled() }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{ secrets.WORKFLOW_TOKEN }}
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v4
with:
node-version: latest
registry-url: "https://registry.npmjs.org"

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate

# pnpm dependencies cannot be cached until pnpm is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: pnpm

- name: Restore the master ref to its original position
if: needs.open-release.outputs.INITIAL_MASTER_POSITION != ''
run: |
CURRENT_REF_POSITION=$(git rev-parse HEAD)
if [ "${CURRENT_REF_POSITION}" != "${{ needs.open-release.outputs.INITIAL_MASTER_POSITION }}" ]; then
git reset --hard ${{ needs.open-release.outputs.INITIAL_MASTER_POSITION }}
if [ "${{ github.ref_type }}" == "tag" ]; then
git ${{ github.ref_type }} -f ${{ github.ref_name }}
fi
git push -f origin ${{ github.ref_name }}
fi

- name: Delete tag
if: needs.open-release.outputs.TAG != ''
run: |
git push --delete origin ${{ needs.open-release.outputs.TAG }}

- name: Restore the gh-pages ref to its original position
if: needs.open-release.outputs.INITIAL_GH_PAGES_POSITION != ''
run: |
CURRENT_REF_POSITION=$(git rev-parse HEAD)
if [ "${CURRENT_REF_POSITION}" != "${{ needs.open-release.outputs.INITIAL_GH_PAGES_POSITION }}" ]; then
git reset --hard ${{ needs.open-release.outputs.INITIAL_GH_PAGES_POSITION }}
if [ "${{ github.ref_type }}" == "tag" ]; then
git ${{ github.ref_type }} -f ${{ github.ref_name }}
fi
git push -f origin ${{ github.ref_name }}
fi
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
syntax: glob
# Maven Wrapper files that will be regenerate automatically
.mvn/wrapper/maven-wrapper.jar

# IntelliJ IDEA
.idea/
/.idea/*
!/.idea
!/.idea/codeStyles

# Files generated as part of the build
**/node_modules/
*.iml

# Java
target/
coverage/

Expand All @@ -15,8 +19,9 @@ coverage/
commonjs.html
modulejs.html

# eslint
/.eslintcache
# Node.js
node_modules/
.eslintcache

# Credentials
/keys.txt
Loading
Loading