Merge pull request #30 from avivharuzi/develop #11
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: CI | |
on: | |
push: | |
branches: [main] | |
jobs: | |
pre-release: | |
name: Pre Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm i | |
- name: Build All | |
run: npm run build:all | |
release: | |
name: Release | |
needs: pre-release | |
if: ${{ !contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'chore(release)') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm i | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm run release | |
publish-npm: | |
name: Publish NPM Package | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm i | |
- name: Build Packages | |
run: npm run build:ngx-glide | |
- name: Store Package Version | |
id: storePackageVersion | |
run: | | |
NEXT_PACKAGE_VERSION="$(grep '\"version\"' package.json | cut -d '"' -f 4 | head -n 1)" | |
echo "::set-output name=nextPackageVersion::$NEXT_PACKAGE_VERSION" | |
- name: Publish Packages | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
for path in ./dist/packages/*; do | |
cd "$path" && npm version "${{ steps.storePackageVersion.outputs.nextPackageVersion }}" --no-git-tag-version --allow-same-version && npm publish --access public && cd - | |
done | |
deploy-demo: | |
name: Deploy Demo | |
needs: pre-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm i | |
- name: Build Demo | |
run: npm run build:ngx-glide-demo | |
- run: cd dist/apps/ngx-glide-demo && cp index.html 404.html && cd - | |
- uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist/apps/ngx-glide-demo |