Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/nullable-odata-props
Browse files Browse the repository at this point in the history
  • Loading branch information
lostfields committed Feb 29, 2024
2 parents 723a830 + 2670940 commit 8b17a0a
Show file tree
Hide file tree
Showing 54 changed files with 14,044 additions and 6,438 deletions.
43 changes: 35 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
name: Build

on:
push:
branches:
- '**'
tags-ignore:
- '*.*'

name: build
workflow_dispatch:
inputs:
deploy:
type: boolean
required: true
description: Deploy package

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.npm.outputs.version }}
prerelease: ${{ steps.npm.outputs.prerelease }}
deploy: ${{ steps.npm.outputs.deploy }}
steps:
- name: build npm package
uses: tfso/action-helpers/npm-build@v1
id: npm
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
FONT_AWESOME_TOKEN: ${{ secrets.FONT_AWESOME_TOKEN }}
NODE_VERSION: 16
TRUNCATE_PRERELEASE: true

tag:
if: needs.build.outputs.deploy == 'true' || github.event.inputs.deploy == 'true'
needs: build
runs-on: ubuntu-latest
name: push tag
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: checkout
uses: actions/checkout@v3

- name: push tag
uses: tfso/action-helpers/tag@v1
with:
node-version: 12
- run: npm ci
- run: npm test
- run: npm run lint
- run: npm run build
GITHUB_TOKEN: ${{ secrets.TFSO_REPO_TAG }}
tag: ${{ needs.build.outputs.version }}
116 changes: 116 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: (Prerelease) Package

on:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+-*' # only preleases, eg v1.0.1-beta.1

env:
FILES: |
lib/
src/
package.json
index.html
LICENSE
README.md
jobs:
setup:
runs-on: ubuntu-latest
name: find version
outputs:
version: v${{ steps.semver.outputs.fullversion }}
prerelease: ${{ steps.semver.outputs.prerelease }}
steps:
- name: extract tag version
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ github.ref }}
version_extractor_regex: 'refs\/tags\/v(.*)$'

build:
if: needs.setup.outputs.prerelease
runs-on: ubuntu-latest
needs: setup
outputs:
version: ${{ needs.setup.outputs.version }}
steps:
- name: build npm package
uses: tfso/action-helpers/npm-build@v1
id: npm
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
FONT_AWESOME_TOKEN: ${{ secrets.FONT_AWESOME_TOKEN }}
CUSTOM_TAG: ${{ needs.setup.outputs.version }}
NODE_VERSION: 16

- name: upload package
uses: actions/upload-artifact@v3
with:
name: package
path: ${{ env.FILES }}
retention-days: 7

# publish-npm:
# runs-on: ubuntu-latest
# name: publish to npm
# needs: build
# steps:
# - name: download package
# uses: actions/download-artifact@v3
# with:
# name: package

# - name: setup
# uses: actions/setup-node@v3
# with:
# node-version: 16
# registry-url: https://registry.npmjs.org/
# scope: '@tfso'

# - name: extract npm tag
# id: npmpublish
# run: |
# echo "tag=$(echo "${PRERELEASE}" | sed 's/v\?[0-9]*\.[0-9]*\.[0-9]*\-\([^.+]*\).*/\1/')" >> $GITHUB_OUTPUT
# env:
# PRERELEASE: ${{ needs.build.outputs.version }}

# - name: publish prerelease version
# run: |
# npm publish --access public --tag ${{ steps.npmpublish.outputs.tag }}
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-github:
runs-on: ubuntu-latest
name: publish to github
needs: build
permissions:
packages: write
steps:
- name: download package
uses: actions/download-artifact@v3
with:
name: package

- name: setup
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: '@tfso'

- name: extract npm tag
id: npmpublish
run: |
echo "tag=$(echo "${PRERELEASE}" | sed 's/v\?[0-9]*\.[0-9]*\.[0-9]*\-\([^.+]*\).*/\1/')" >> $GITHUB_OUTPUT
env:
PRERELEASE: ${{ needs.build.outputs.version }}

- name: publish prerelease version
run: |
npm publish --access public --tag ${{ steps.npmpublish.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133 changes: 83 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,105 @@
name: (Release) Package

on:
release:
types: [created]
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+' # only full releases, eg v1.0.1

name: release
env:
FILES: |
lib/
src/
package.json
index.html
LICENSE
README.md
jobs:
build:
name: create release
setup:
environment: prod
runs-on: ubuntu-latest
name: find version
outputs:
version: v${{ steps.semver.outputs.fullversion }}
prerelease: ${{ steps.semver.outputs.prerelease }}
steps:
- name: build code
uses: actions/checkout@v2
- name: build project
run: |
npm ci
npm test
npm run lint
npm run build
env:
CI: true
- name: upload artifact
uses: actions/[email protected]
- name: extract tag version
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1
with:
path: |
lib/
src/
package.json
index.html
LICENSE
README.md
input_string: ${{ github.ref }}
version_extractor_regex: 'refs\/tags\/v(.*)$'

publish-npm:
name: publish npm
if: "!github.event.release.prerelease"
needs: build
build:
runs-on: ubuntu-latest
needs: setup
steps:
- name: download artifact
uses: actions/[email protected]
- name: setup
uses: actions/setup-node@v1
- name: build npm package
uses: tfso/action-helpers/npm-build@v1
id: npm
with:
node-version: 12
registry-url: https://registry.npmjs.org/
scope: "@tfso"
- name: publish
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
FONT_AWESOME_TOKEN: ${{ secrets.FONT_AWESOME_TOKEN }}
CUSTOM_TAG: ${{ needs.setup.outputs.version }}
NODE_VERSION: 16

- name: upload package
uses: actions/upload-artifact@v3
with:
name: package
path: ${{ env.FILES }}
retention-days: 7

# publish-npm:
# name: publish to npm
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: check npm
# if: ${{ !env.NPM_TOKEN }}
# run: |
# exit 1

# - name: download artifact
# uses: actions/download-artifact@v3
# with:
# name: package

# - name: setup
# uses: actions/setup-node@v1
# with:
# node-version: 16
# registry-url: https://registry.npmjs.org/
# scope: "@tfso"

# - name: publish
# run: |
# npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-github:
name: publish npm to github
if: "!github.event.release.prerelease" # https://developer.github.com/v3/activity/events/types/#releaseevent
name: publish to github
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: download artifact
uses: actions/[email protected]
uses: actions/download-artifact@v3
with:
name: package

- name: setup
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: "@tfso"
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: '@tfso'

- name: publish
run: |
npm publish
npm publish --access public
env:
CI: true
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
Linq, AST Visitors, CRUD repository using JavaScript/OData Expressions as a boolean predicate for filter

![build](https://github.com/tfso/js-enumerable/workflows/build/badge.svg?branch=master)

## Publish to NPM
Bump version by using `npm version [patch | minor | major]` and create a new release for the version tagging in Github

3 changes: 2 additions & 1 deletion js-enumerable.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@
"lib": true,
"coverage": true
},
"mochaExplorer.files": "src/test/*.ts",
"mochaExplorer.files": "src/test/**/*.ts",
"mochaExplorer.require": [
"ts-node/register",
"./src/test/setup/mocha-require.ts"
],
"mochaExplorer.ignore": "src/test/index.ts",
"mocha.files.glob": "src/test/**/*.ts",
"mocha.requires": [
"ts-node/register",
Expand Down
Loading

0 comments on commit 8b17a0a

Please sign in to comment.