Build #437
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: 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 }} | |