Skip to content

Commit

Permalink
ci: migrate release process to NX (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
janivo committed Dec 15, 2023
1 parent 70b0523 commit 0b42a62
Show file tree
Hide file tree
Showing 32 changed files with 519 additions and 3,709 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-example-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy Example Projects

on:
workflow_run:
workflows: [ "Test & Build" ]
workflows: ['Quality Control']
types: [completed]
branches: [master]

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/deploy-landingpage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ name: Deploy Landingpage

on:
push:
branches:
- master
paths:
- packages/landingpage/**
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/dependencies-install
- name: Build landingpage ⚒️
run: yarn build:landingpage
run: yarn nx run landingpage:build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/deploy-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Deploy Pre-Release'

on:
push:
paths:
- packages/elements/**
- packages/elements-angular/**
- packages/elements-react/**
- packages/elements-vue/**

jobs:
canary-release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Track master branch to make nx affected work
run: |
git branch --track main origin/master
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org
scope: '@inovex.de' # important for yarn
always-auth: true
- uses: ./.github/workflows/dependencies-install
- name: Setup Git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor}}@users.noreply.github.com"
- name: Build libs
run: yarn run nx run-many -t build -p elements,elements-angular,elements-react,elements-vue
- name: Version
shell: bash
run: yarn nx run workspace:version --configuration=prerelease
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Deploy Release'

on:
- workflow_dispatch

jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Track master branch to make nx affected work
run: |
git branch --track main origin/master
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org
scope: '@inovex.de' # important for yarn
always-auth: true
- uses: ./.github/workflows/dependencies-install
- name: Setup Git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor}}@users.noreply.github.com"
- name: Build libs
run: yarn run nx run-many -t build -p elements,elements-angular,elements-react,elements-vue
- name: Version
shell: bash
run: yarn nx run workspace:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'Deploy Storybook'

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/dependencies-install
- run: npm config set scripts-prepend-node-path true
- name: Build Storybook
run: yarn nx run storybook:build
- name: Upload Storybook artifact
uses: ./.github/workflows/artifacts-upload
with:
upload-storybook-artifact: true

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout pages branch
uses: actions/checkout@v3
with:
ref: pages
- name: Download Storybook artifact
uses: dawidd6/action-download-artifact@v2
with:
name: storybook
path: version/${{ github.ref_name }} # Push to the proper directory on gh pages branch.
check-artifacts: true # search in current workflow run
workflow-conclusion: 'in_progress' # need to change to in_progress, cause current workflow run is always running
- name: Provide latest symlink
if: ${{ ! contains( github.ref_name, '-' ) }} # only link to latest for releases (e.g. v7.0.0), not pre-releases (e.g. v.7.0.0-1)
run: cd version && rm -f latest && ln -s ${{ github.ref_name }} latest
shell: bash

# Crawls the version dir on current pages branch HEAD.
# Jq extracts the directory name of the versions and transfers it to an array of the form ["0.1.1", "0.2.1"].
- name: Update Hosted Versions
run: find ./version/* -type d -maxdepth 0 | cut -c 11- | jq -R -s -c 'split("\n")[:-1]' > ./hosted-versions.json

- name: Deploy to Github Pages 🚀
uses: JamesIves/[email protected]
with:
branch: pages
commit-message: Deploying version ${{ github.ref_name }} 🚀
folder: '.'
clean: false # Important to keep other versions.
114 changes: 0 additions & 114 deletions .github/workflows/deploy-version.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/prepare-release.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/release-canary.yml

This file was deleted.

Loading

0 comments on commit 0b42a62

Please sign in to comment.