on-release #12
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: on-release | |
on: | |
push: | |
tags: | |
- v* | |
env: | |
NX_BRANCH: ${{ github.event.number }} | |
NX_RUN_GROUP: ${{ github.run_id }} | |
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} | |
MOZ_HEADLESS: 1 | |
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
# one run | |
one_run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
# install dependencies | |
install: | |
runs-on: ubuntu-latest | |
needs: one_run | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: node_modules | |
key: node_modules-${{ hashFiles('**/package-lock.json') }} | |
- run: npm ci | |
if: steps.cache.outputs.cache-hit != 'true' | |
# build ng2-file-upload | |
build: | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node_modules-${{ hashFiles('**/package-lock.json') }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
dist | |
key: dist-${{ github.run_id }} | |
- run: | | |
npx nx run ng2-file-upload:build --configuration production | |
npx nx run ng2-file-upload-demo:build --configuration production | |
# update release notes in github | |
update_release_draft: | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node_modules-${{ hashFiles('**/package-lock.json') }} | |
- run: npx conventional-github-releaser -p angular | |
# update gh_pages | |
gh_pages_deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
ref: 'gh-pages' | |
path: 'gh-pages' | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node_modules-${{ hashFiles('**/package-lock.json') }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
dist | |
key: dist-${{ github.run_id }} | |
- run: | | |
cd gh-pages | |
git config user.email gh-actions-${GITHUB_ACTOR}@github.com | |
git config user.name $GITHUB_ACTOR | |
git add -A | |
git commit -am "ci: gh-pages update" | |
continue-on-error: true | |
- name: push to gh-pages | |
uses: ad-m/[email protected] | |
continue-on-error: true | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: 'gh-pages' | |
directory: 'gh-pages' | |
# publish to npm | |
npm_publish: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node_modules-${{ hashFiles('**/package-lock.json') }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
dist | |
key: dist-${{ github.run_id }} | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
package: "dist/libs/ng2-file-upload/package.json" | |
token: ${{ secrets.NPM_TOKEN }} | |