feat: refactor & upgrade to Angular 16, main dependencies (no RxDB upgrade yet) #95
Workflow file for this run
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
name: main | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
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: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# strategy: | |
# matrix: | |
# node-version: [12.x, 14.x] | |
steps: | |
- name: Echo 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: 18 | |
# | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ 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 | |
# if: github.event.release.published | |
run: npm run packages:build | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist-packages | |
path: | |
dist/packages | |
# !dist/**/*.md | |
# Build if release published | |
- name: Build Demo | |
# if: github.event.release.published | |
run: npm run build:demo && npm run compodoc | |
### | |
- name: Upload demo artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'dist/demo' | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
preview: false | |
publish: | |
if: github.event.pull_request.merged || github.event.release.published | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
# - uses: actions/checkout@v2 | |
# - name: Download all workflow run artifacts | |
# - uses: actions/cache@v2 | |
- uses: actions/download-artifact@v2 | |
- name: Version and publish | |
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 version minor --force -m "v%s" -m "build(*): release new version [build-skip]" | |
git push gh-origin HEAD:master --tags | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
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: | |
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 |