Skip to content

Commit

Permalink
ci workflow publishing (#26)
Browse files Browse the repository at this point in the history
* v2.2.0

* refactor(*): change to packages & examples folder names
* feat(ci): add `coveralls` & npm publish github actions configs
* feat(ci): add tools to update metadata & publish multiple packages
* fix(ci): test w\o nyc & merge lcov
* docs(*): add necessary legal files
  • Loading branch information
voznik authored Dec 22, 2020
1 parent 4f9fe25 commit f5cfde7
Show file tree
Hide file tree
Showing 95 changed files with 1,128 additions and 203 deletions.
71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
-->

## I'm submitting a...

<!-- Check one of the following options with "x" -->
<pre><code>
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => https://github.com/voznik/ngx-odm/blob/master/CONTRIBUTING.md
[ ] Other... Please describe:
</code></pre>

## Current behavior

<!-- Describe how the issue manifests. -->

## Expected behavior

<!-- Describe what the desired behavior would be. -->

## Minimal reproduction of the problem with instructions

<!--
For bug reports please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via
https://stackblitz.com/fork/ngx-odm
* Step 1
* Step 2
* Step 3
-->

**Note:** Our policy is that issues reported without a reproduction will be closed immediately and then reopened once a reproduction has been provided. Please respect the developers of this project by doing this. We give of our personal time to work on this project and would rather be spending our time fixing or enhancing the library than chasing down badly described or unreproducable issues.
Please delete this note once you have read it.

## What is the motivation / use case for changing the behavior?

<!-- Describe the motivation or the concrete use case. -->

## Environment

<pre><code>
Libs:
- @angular/core version: X.Y.Z
- @ngx-odm/rxdb version: X.Y.Z
<!-- Check whether this is still an issue in the most recent Angular version -->

Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: XX <!-- run `node --version` -->
- Platform: <!-- Mac, Linux, Windows -->

Others:
<!-- Anything else relevant? Operating system version, IDE, package manager, HTTP server, ... -->
</code></pre>
43 changes: 43 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our guidelines: https://github.com/voznik/ngx-odm/blob/master/CONTRIBUTING.md#commit
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)

## PR Type

What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:
```

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

## Does this PR introduce a breaking change?

```
[ ] Yes
[ ] No
```

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->

## Other information
70 changes: 55 additions & 15 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches: [master]
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -19,12 +22,21 @@ jobs:
# matrix:
# node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Build on Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: My first step
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }}
run: echo This event is a pull request that was opened.
#
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
#
- name: Build on Node.js # ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
# node-version: ${{ matrix.node-version }}
node-version: 12
#
- name: Cache node modules
uses: actions/cache@v2
env:
Expand All @@ -37,14 +49,26 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
#
- name: Install
run: npm ci
- name: Lint & Test
run: npm run packages:lint && npm run packages:test
env:
CI: true
# Save coverage report in Coveralls
- name: Coveralls
if: ${{ success() }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
COVERALLS_SERVICE_NAME: '@ngx-odm'
COVERALLS_PARALLEL: true
# Build if release published
- name: Build
run: npm run packages:build --if-present
if: github.event.release.published
run: npm run packages:build
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
Expand All @@ -54,21 +78,37 @@ jobs:
# !dist/**/*.md

publish:
# if: github.ref == 'refs/heads/main'
# if: github.event.pull_request.merged
if: github.event.release.published
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
# - name: Download all workflow run artifacts
# uses: actions/download-artifact@v2
- name: Version and publish
### echo "//registry.npmjs.org/:_authToken=$NPM_API_TOKEN" >> ~/.npmrc
run: |
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm install
npm version minor --force -m "v%s" -m "build(*): release new version [build-skip]"
npm run packages:build
git push gh-origin HEAD:master --tags
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Publish
run: |
cd dist-packages/rxdb
npm pack
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --ignore-scripts
registry-url: 'https://registry.npmjs.org'
- run: |
npm run packages:publish:dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v2
with:
registry-url: 'https://npm.pkg.github.com'
- run: |
npm run packages:publish:dev
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/docs
/tmp
/out-tsc
**/builds
**/@ngx-odm*

# dependencies
/node_modules
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://registry.npmjs.org
allow-same-version=true
scope=@ngx-odm
22 changes: 21 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,32 @@
"--codeCoverage=false",
"--testFile=${fileBasenameNoExtension}",
"--watchAll",
"--colors"
"--colors",
"--runInBand=true"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
},
{
"name": "Tools: Ts-Node: Current File",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"args": ["${relativeFile}"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"skipFiles": ["<node_internals>/**", "node_modules/**"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"TS_NODE_PROJECT": "${workspaceFolder}/tools/tsconfig.tools.json",
"TS_NODE_TRANSPILE_ONLY": "true"
},
"disableOptimisticBPs": true
}
],
"inputs": [
Expand Down
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
Loading

0 comments on commit f5cfde7

Please sign in to comment.