-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from tfso/full-upgrade
Full upgrade
- Loading branch information
Showing
28 changed files
with
7,386 additions
and
3,791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": ["@tfso/eslint-config/typescript", "prettier"], | ||
"env": { | ||
"mocha": true | ||
}, | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ "vars": "all", "args": "none", "ignoreRestSiblings": true } | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,79 @@ | ||
## The workflow will: | ||
## - create a new version, build the package and run tests | ||
## - publish a release to npm when you create a new GitHub release. | ||
## - publish a prerelease to npm from: | ||
## - main branch | ||
## - all branches with #deploy_branch in the commit message. | ||
## | ||
## The workflow assumes the following: | ||
## - package.json has a "version" property | ||
## - package.json has a "name" with the format "@tfso/<my-package>" | ||
## - package.json has the following scripts | ||
## - "build" - build the package into the ./dist folder | ||
## - "test" | ||
## - the project is installable with "npm ci" | ||
|
||
name: Build Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
tags-ignore: | ||
- "*.*" | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '*.*' | ||
|
||
jobs: | ||
Publish: | ||
name: Build Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: build code | ||
uses: actions/checkout@v3 | ||
|
||
- name: setup | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: npm access token | ||
run: | | ||
npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc | ||
npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} | ||
|
||
- name: build project | ||
run: | | ||
npm install | ||
npm run build | ||
build: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.npm.outputs.version }} | ||
prerelease: ${{ steps.npm.outputs.prerelease }} | ||
is_prerelease: ${{ steps.npm.outputs.is_prerelease }} | ||
deploy: ${{ steps.npm.outputs.deploy }} | ||
|
||
steps: | ||
- name: Install, build and test | ||
uses: tfso/action-helpers/npm-build@v1 | ||
id: npm | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_GLOBAL_TOKEN: ${{ secrets.TFSO_REPO_READ }} | ||
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} | ||
TRUNCATE_PRERELEASE: true | ||
NODE_VERSION: 18 | ||
|
||
- name: upload artifact (from content in ./dist folder) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ./dist | ||
|
||
publish: | ||
name: publish prerelease | ||
if: ${{ needs.build.outputs.deploy == 'true' }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
|
||
- name: setup | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@tfso' | ||
|
||
- name: Publish prerelease to Npm | ||
run: | | ||
npm version prerelease --preid=${{github.ref_name}}-${{github.run_number}} --no-git-tag-version | ||
npm publish --verbose --tag dev --no-tag | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,88 @@ | ||
## The workflow will: | ||
## - create a new version, build the package and run tests | ||
## - publish a release to npm when you create a new GitHub release. | ||
## - publish a prerelease to npm from: | ||
## - main branch | ||
## - all branches with #deploy_branch in the commit message. | ||
## | ||
## The workflow assumes the following: | ||
## - package.json has a "version" property | ||
## - package.json has a "name" with the format "@tfso/<my-package>" | ||
## - package.json has the following scripts | ||
## - "build" - build the package into the ./dist folder | ||
## - "test" | ||
## - the project is installable with "npm ci" | ||
|
||
name: Release Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: create release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
build: | ||
name: build release | ||
runs-on: ubuntu-latest | ||
if: github.event.release.draft == false && github.event.release.prerelease == false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: npm access token | ||
run: | | ||
npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc | ||
npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} | ||
|
||
- name: Update package.json and CHANGELOG.md | ||
run: | | ||
git config --global user.name '${{github.actor}}' | ||
git config --global user.email '${{github.actor}}@users.noreply.github.com' | ||
npm version ${{github.event.release.tag_name}} --no-git-tag-version | ||
npx auto-changelog -p && git add CHANGELOG.md | ||
git add package.json | ||
git commit -m "Update package.json version to ${{github.event.release.tag_name}} " | ||
git push origin HEAD:${{github.event.release.target_commitish}} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: npm access token | ||
run: | | ||
npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc | ||
npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} | ||
- name: install project | ||
run: npm ci | ||
|
||
- name: Update package.json | ||
run: | | ||
git config --global user.name '${{github.actor}}' | ||
git config --global user.email '${{github.actor}}@users.noreply.github.com' | ||
npm version ${{github.event.release.tag_name}} --no-git-tag-version | ||
git add package.json | ||
git commit -m "Update package.json version to $version" | ||
git push origin HEAD:master | ||
- name: build project | ||
run: npm run build | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: build project | ||
run: | | ||
npm install | ||
npm run build | ||
- name: upload artifact (from content in ./dist folder) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ./dist | ||
|
||
- name: upload artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: artifact | ||
path: | | ||
dist/ | ||
package.json | ||
README.md | ||
publish: | ||
name: publish release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
publish-gpr: | ||
name: publish to github | ||
if: github.event.release.draft == false && github.event.release.prerelease == false | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: download artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: artifact | ||
steps: | ||
- name: download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
|
||
- name: setup | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: "@tfso" | ||
- name: setup | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@tfso' | ||
|
||
- name: publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Publish release to Npm | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.idea/ | ||
node_modules/ | ||
dist/ | ||
.nyc_output/ | ||
coverage/ | ||
coverage/ | ||
dist/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
.nyc_output | ||
coverage | ||
package-lock.json | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 4, | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#! /bin/bash | ||
|
||
export dir=dist | ||
if [[ ! -e $dir ]]; then | ||
mkdir $dir | ||
elif [[ ! -d $dir ]]; then | ||
echo "$dir already exists but is not a directory" 1>&2 | ||
fi | ||
|
||
tsc | ||
|
||
rm -rf ./dist/* | ||
cp -r ./build/. ./dist/. | ||
cp README.md ./dist/ | ||
cp package.json ./dist/ | ||
rm -rf ./dist/test |
Oops, something went wrong.