Skip to content

Commit

Permalink
Merge branch 'main' into generic-exponent
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Cook <[email protected]>
  • Loading branch information
jmcook1186 authored May 21, 2024
2 parents 0b08e12 + fcd94cc commit 356dd2f
Show file tree
Hide file tree
Showing 12 changed files with 1,465 additions and 32 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/npm-publish-ci.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/release-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release commit
on:
release:
types: [published]

env:
PR_BRANCH_NAME: release-${{github.event.release.tag_name}}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm test

create-release-commit:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci

- name: Initalize git user email
run: git config --global user.email "${{vars.RELEASE_USER_EMAIL}}"

- name: Initalize git user name
run: git config --global user.name "Release commit workflow"

- name: Create release branch
run: |
git checkout -b $PR_BRANCH_NAME
git push --set-upstream origin $PR_BRANCH_NAME
echo "branch=$PR_BRANCH_NAME" >> $GITHUB_ENV
- name: Bump version and push changes using release-it
run: |
npm run release -- --ci ${{github.event.release.tag_name}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
run: gh pr create -B ${{ github.event.repository.default_branch }} -H $PR_BRANCH_NAME --title "Release ${{github.event.release.tag_name}}" --body "${{github.event.release.body}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

56 changes: 56 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release publish NPM
on:
push:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npm test
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci
- name: Initalize git user email
run: git config --global user.email "${{env.RELEASE_USER_EMAIL}}"
- name: Initalize git user name
run: git config --global user.name "Release publish workflow"

- name: Initialize npm config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Check if release is a pre-release
id: check_pre_release
run: echo "{name}=${{github.event.release.prerelease}}" >> $GITHUB_OUTPUT

- name: Publish to npm
if: steps.check_pre_release.outputs.is_pre_release == 'true'
run: npm publish --tag beta
env:
GITHUB_TOKEN: ${{secrets.github_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Publish to npm
if: steps.check_pre_release.outputs.is_pre_release != 'true'
run: npm publish
env:
GITHUB_TOKEN: ${{secrets.github_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
6 changes: 6 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
'*.ts': [
'gts lint',
],
'package.json': 'fixpack',
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Shell](./src/lib/shell/README.md)
- [Sum](./src/lib/sum/README.md)
- [Exponent](./src/lib/exponent/README.md)
- [Subtract](./src/lib/subtract/README.md)
- [TDP Finder](./src/lib/tdp-finder/README.md)

## Contributing
Expand Down
Loading

0 comments on commit 356dd2f

Please sign in to comment.