Skip to content

Merge pull request #237 from capitec/select-inheritance-support #427

Merge pull request #237 from capitec/select-inheritance-support

Merge pull request #237 from capitec/select-inheritance-support #427

Workflow file for this run

name: Build
on:
push:
branches: [ main,develop,alpha ]
paths-ignore:
- '*.md'
- '**/*.md'
- 'package.json'
- 'package-lock.json'
release:
types:
- published
permissions: write-all
env:
DOCS_BASE_PATH: docs/omni-components
LOCAL_VERSION:
jobs:
build-and-release:
if: ${{ github.repository_owner == 'capitec' && github.repository_owner_id == '109590421' }}
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
runs-on: macos-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Dump env πŸ’©
run: env | sort
- name: Dump GitHub context πŸ’©
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Contribute List βž•
uses: akhilmhdh/[email protected]
# Only on branch pushes, not on tagged releases
if: ${{ startsWith(github.ref, 'refs/heads/') }}
with:
image_size: 100
use_username: true
readme_path: .tooling/readme/contributors.md
auto_detect_branch_protection: false
env:
GITHUB_TOKEN: ${{ secrets.PROTECTED_TOKEN }}
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v3
with:
persist-credentials: true
fetch-depth: 0
token: ${{ secrets.PROTECTED_TOKEN }}
- name: Ensure branch up to date 🌿
# Only on branch pushes, not on tagged releases
if: ${{ startsWith(github.ref, 'refs/heads/') }}
run: |
git pull
- name: Use Node.js 16.x βœ”
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
always-auth: true
- name: Install Package Dependencies πŸ”—
# https://peps.python.org/pep-0632/#migration-advice
# https://github.com/actions/runner/issues/2958#issuecomment-2186602747
run: |
pip install packaging
pip install --upgrade setuptools
brew install python-setuptools
npm ci --force
- name: Bump patch version for alpha ☝
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
run: |
node .tooling/scripts/unique-version.mjs --tag "alpha"
- name: Bump patch version for beta ☝
# Develop branch only
if: github.ref == 'refs/heads/develop'
run: |
node .tooling/scripts/unique-version.mjs --tag "beta"
- name: Bump patch version for next ☝
# Main branch only
if: github.ref == 'refs/heads/main'
run: |
node .tooling/scripts/unique-version.mjs --tag "next"
- name: Build Docs (Alpha) πŸ“
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
run: |
npm run docs
cp .oss-docs.json docs/.oss-docs.json
env:
ELEVENTY_BASE_PATH: /open-source/${{ env.DOCS_BASE_PATH }}/versions/alpha/
ELEVENTY_DOCS_VERSION: alpha
- name: Build Docs (Beta) πŸ“
# Develop branch only
if: github.ref == 'refs/heads/develop'
run: |
npm run docs
cp .oss-docs.json docs/.oss-docs.json
env:
ELEVENTY_BASE_PATH: /open-source/${{ env.DOCS_BASE_PATH }}/versions/beta/
ELEVENTY_DOCS_VERSION: beta
- name: Build Docs (Next) πŸ“
# Main branch only
if: github.ref == 'refs/heads/main'
run: |
npm run docs
cp .oss-docs.json docs/.oss-docs.json
env:
ELEVENTY_BASE_PATH: /open-source/${{ env.DOCS_BASE_PATH }}/versions/next/
ELEVENTY_DOCS_VERSION: next
- name: Auto Commit Changes πŸ‘©β€πŸ’»
uses: stefanzweifel/git-auto-commit-action@v4
# Only on branch pushes, not on tagged releases
if: ${{ startsWith(github.ref, 'refs/heads/') }}
with:
commit_message: Updated docs
branch: ${{ env.GITHUB_REF_NAME }}
- name: Publish Alpha Docs πŸš€
uses: JamesIves/[email protected]
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: capitec/open-source
branch: main
folder: docs # The folder to grab the built docs files from
target-folder: ${{ env.DOCS_BASE_PATH }}/versions/alpha # The folder to commit the build docs files into
clean: true # Clean out any previous files in the target folder
clean-exclude: |
versions
git-config-name: Deploy Bot
git-config-email: [email protected]
- name: Publish Beta Docs πŸš€
uses: JamesIves/[email protected]
# Develop branch only
if: github.ref == 'refs/heads/develop'
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: capitec/open-source
branch: main
folder: docs # The folder to grab the built docs files from
target-folder: ${{ env.DOCS_BASE_PATH }}/versions/beta # The folder to commit the build docs files into
clean: true # Clean out any previous files in the target folder
clean-exclude: |
versions
git-config-name: Deploy Bot
git-config-email: [email protected]
- name: Publish Next Docs πŸš€
uses: JamesIves/[email protected]
# Main branch only
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: capitec/open-source
branch: main
folder: docs # The folder to grab the built docs files from
target-folder: ${{ env.DOCS_BASE_PATH }}/versions/next # The folder to commit the build docs files into
clean: true
# Dont clean the versions directory when deploying to latest docs path
clean-exclude: |
versions
git-config-name: Deploy Bot
git-config-email: [email protected]
- name: Build Docs (Version) πŸ“
# Tagged release branch only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
npm run docs
cp .oss-docs.json docs/.oss-docs.json
env:
ELEVENTY_BASE_PATH: /open-source/${{ env.DOCS_BASE_PATH }}/versions/${{ github.event.release.tag_name }}/
ELEVENTY_DOCS_VERSION: ${{ github.event.release.tag_name }}
- name: Publish Version Docs πŸš€
uses: JamesIves/[email protected]
# Tagged release branch only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: capitec/open-source
branch: main
folder: docs # The folder to grab the built docs files from
target-folder: ${{ env.DOCS_BASE_PATH }}/versions/${{ github.event.release.tag_name }} # The folder to commit the build docs files into
clean: true
clean-exclude: |
versions
git-config-name: Deploy Bot
git-config-email: [email protected]
- name: Build Docs (Latest) πŸ“
# Release only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
npm run docs
cp .oss-docs.json docs/.oss-docs.json
env:
ELEVENTY_BASE_PATH: /open-source/${{ env.DOCS_BASE_PATH }}/
ELEVENTY_DOCS_VERSION: ${{ github.event.release.tag_name }}
- name: Publish Latest Docs πŸš€
uses: JamesIves/[email protected]
# Release only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: capitec/open-source
branch: main
folder: docs # The folder to grab the built docs files from
target-folder: ${{ env.DOCS_BASE_PATH }} # The folder to commit the build docs files into
clean: true
# Dont clean the versions directory when deploying to latest docs path
clean-exclude: |
versions
git-config-name: Deploy Bot
git-config-email: [email protected]
- name: Update LOCAL_VERSION ⬆
# Branches only, not releases
if: ${{ startsWith(github.ref, 'refs/heads/') }}
run: |
LOCAL_VERSION=$(cat package.json | jq -r .version | awk '{ print tolower($1) }')
echo LOCAL_VERSION=${LOCAL_VERSION} >> $GITHUB_ENV
- name: Build Project πŸ”§
run: |
npm run compile
- name: Publish Latest Package πŸ“¦
# Release only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
npm version "${{ github.event.release.tag_name }}" -git-tag-version false -allow-same-version true
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Latest React Package πŸ“¦
# Release only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
working-directory: ./.tooling/react-wrapper
run: |
npm i
npm run generate
cd dist && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Alpha Package πŸ“¦
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
run: |
npm version "${{ env.LOCAL_VERSION }}-alpha" -git-tag-version false -allow-same-version true
npm publish --tag alpha --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Alpha React Package πŸ“¦
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
working-directory: ./.tooling/react-wrapper
run: |
npm i
npm run generate
cd dist && npm publish --tag alpha --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Beta Package πŸ“¦
# Develop branch only
if: github.ref == 'refs/heads/develop'
run: |
npm version "${{ env.LOCAL_VERSION }}-beta" -git-tag-version false -allow-same-version true
npm publish --tag beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Beta React Package πŸ“¦
# Develop branch only
if: github.ref == 'refs/heads/develop'
working-directory: ./.tooling/react-wrapper
run: |
npm i
npm run generate
cd dist && npm publish --tag beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Next Package πŸ“¦
# Main branch only
if: github.ref == 'refs/heads/main'
run: |
npm version "${{ env.LOCAL_VERSION }}-next" -git-tag-version false -allow-same-version true
npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Next React Package πŸ“¦
# Main branch only
if: github.ref == 'refs/heads/main'
working-directory: ./.tooling/react-wrapper
run: |
npm i
npm run generate
cd dist && npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Bundle for ESM πŸ’Ό
run: |
npx -p @innofake/merge-index merge-index --dir src --out src/omni-components.js
npm run bundle
- name: Publish Latest ESM Package πŸ“¦
# Release only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
npm version "${{ github.event.release.tag_name }}-esm" -git-tag-version false -allow-same-version true
npm publish --tag esm --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Latest React ESM Package πŸ“¦
# Release only
if: ${{ startsWith(github.ref, 'refs/tags/') }}
working-directory: ./.tooling/react-wrapper
run: |
npm run bundle
cd bundle-dist && npm publish --tag esm --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Alpha ESM Package πŸ“¦
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
run: |
npm version "${{ env.LOCAL_VERSION }}-esm-alpha" -git-tag-version false -allow-same-version true
npm publish --tag esm-alpha --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Alpha React ESM Package πŸ“¦
# Alpha branch only
if: github.ref == 'refs/heads/alpha'
working-directory: ./.tooling/react-wrapper
run: |
npm run bundle
cd bundle-dist && npm publish --tag esm-alpha --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Beta ESM Package πŸ“¦
# Develop branch only
if: github.ref == 'refs/heads/develop'
run: |
npm version "${{ env.LOCAL_VERSION }}-esm-beta" -git-tag-version false -allow-same-version true
npm publish --tag esm-beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Beta React ESM Package πŸ“¦
# Develop branch only
if: github.ref == 'refs/heads/develop'
working-directory: ./.tooling/react-wrapper
run: |
npm run bundle
cd bundle-dist && npm publish --tag esm-beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Next ESM Package πŸ“¦
# Main branch only
if: github.ref == 'refs/heads/main'
run: |
npm version "${{ env.LOCAL_VERSION }}-esm-next" -git-tag-version false -allow-same-version true
npm publish --tag esm-next --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Next React ESM Package πŸ“¦
# Main branch only
if: github.ref == 'refs/heads/main'
working-directory: ./.tooling/react-wrapper
run: |
npm run bundle
cd bundle-dist && npm publish --tag esm-next --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}