From 7763c53867341b4eaee271ce0b88e6bc8203c4da Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Tue, 27 Feb 2024 08:46:48 +0100 Subject: [PATCH] add first release draft --- .../actions/angular-build/action.yml | 22 +++++ .../actions/angular-setup/action.yml | 15 ---- .../{angular => angular-test}/action.yml | 0 .../actions/release-build/action.yml | 27 ++++++ .../actions/release-setup/action.yml | 27 ++++++ .github/workflows/continuous.yml | 5 +- .github/workflows/release.yml | 89 +++++++++++++++++++ docs/project.json | 3 +- .../visual/bal-nav-menu-flyout.visual.cy.ts | 2 +- e2e/project.json | 3 +- libs/nx/project.json | 2 +- libs/output-target-angular/project.json | 2 +- libs/output-target-react/project.json | 2 +- libs/output-target-vue/project.json | 2 +- packages/angular-common/project.json | 4 +- packages/angular-legacy/project.json | 4 +- packages/angular-module/project.json | 4 +- packages/angular/project.json | 4 +- packages/brand-icons/project.json | 2 +- packages/core/project.json | 2 +- packages/css/project.json | 2 +- packages/devkit/project.json | 2 +- packages/favicons/project.json | 3 +- packages/fonts/project.json | 3 +- packages/icons/project.json | 2 +- packages/maps/project.json | 2 +- packages/react/project.json | 4 +- packages/styles/project.json | 2 +- packages/table/project.json | 2 +- packages/testing/project.json | 2 +- packages/tokens/project.json | 2 +- packages/vue/project.json | 4 +- 32 files changed, 204 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/actions/angular-build/action.yml rename .github/workflows/actions/{angular => angular-test}/action.yml (100%) create mode 100644 .github/workflows/actions/release-build/action.yml create mode 100644 .github/workflows/actions/release-setup/action.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/actions/angular-build/action.yml b/.github/workflows/actions/angular-build/action.yml new file mode 100644 index 00000000..207f6b5d --- /dev/null +++ b/.github/workflows/actions/angular-build/action.yml @@ -0,0 +1,22 @@ +name: 'Angular Build' +description: 'Angular Build' +inputs: + app: + description: 'The specific test application' +runs: + using: 'composite' + steps: + - name: Create App + run: bash build.sh ${{ inputs.app }} + working-directory: ./test/angular + shell: bash + + - name: Install Cypress + run: npm run cy:install + working-directory: ./test/angular/${{ inputs.app }} + shell: bash + + - name: Build Angular App + run: npm run build + working-directory: ./test/angular/${{ inputs.app }} + shell: bash diff --git a/.github/workflows/actions/angular-setup/action.yml b/.github/workflows/actions/angular-setup/action.yml index 7bff4ed6..f338c3f2 100644 --- a/.github/workflows/actions/angular-setup/action.yml +++ b/.github/workflows/actions/angular-setup/action.yml @@ -69,18 +69,3 @@ runs: name: testing-dist path: ./packages/testing filename: TestingDist.zip - - - name: Setup App - run: bash build.sh ${{ inputs.app }} - working-directory: ./test/angular - shell: bash - - - name: Install Cypress - run: npm run cy:install - working-directory: ./test/angular/${{ inputs.app }} - shell: bash - - - name: Build Angular App - run: npm run build - working-directory: ./test/angular/${{ inputs.app }} - shell: bash diff --git a/.github/workflows/actions/angular/action.yml b/.github/workflows/actions/angular-test/action.yml similarity index 100% rename from .github/workflows/actions/angular/action.yml rename to .github/workflows/actions/angular-test/action.yml diff --git a/.github/workflows/actions/release-build/action.yml b/.github/workflows/actions/release-build/action.yml new file mode 100644 index 00000000..0cb35dc4 --- /dev/null +++ b/.github/workflows/actions/release-build/action.yml @@ -0,0 +1,27 @@ +name: 'Build' +description: 'Build' +runs: + using: 'composite' + steps: + - name: Clean install + shell: bash + run: npm ci + + - name: Define Nx cache + uses: nrwl/nx-set-shas@v4 + + - name: Check format + shell: bash + run: npx nx format:check + + - name: Check spelling + shell: bash + run: npm run spell + + - name: Lint & Test & Build + shell: bash + run: npx nx run-many -t build --projects=tag:scope:release + + - name: Releae dry-run + shell: bash + run: npx nx release publish -d diff --git a/.github/workflows/actions/release-setup/action.yml b/.github/workflows/actions/release-setup/action.yml new file mode 100644 index 00000000..2fc95b42 --- /dev/null +++ b/.github/workflows/actions/release-setup/action.yml @@ -0,0 +1,27 @@ +name: 'Setup Release' +description: 'Setup Release' +inputs: + token: + description: 'The GitHub token required.' + npm-token: + description: 'The NPM authentication token required to publish.' +runs: + using: 'composite' + steps: + - name: Git Identity + run: | + git config --global user.name 'baopso' + git config --global user.email 'Group.CH_Open-Source@baloise.ch' + git remote set-url origin https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.token }} + + - name: Create .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + shell: bash + env: + NPM_TOKEN: ${{ inputs.npm-token }} diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml index d0b0e7f5..3792fb03 100644 --- a/.github/workflows/continuous.yml +++ b/.github/workflows/continuous.yml @@ -82,6 +82,9 @@ jobs: - uses: ./.github/workflows/actions/angular-setup with: app: ${{ matrix.apps }} - - uses: ./.github/workflows/actions/angular + - uses: ./.github/workflows/actions/angular-build + with: + app: ${{ matrix.apps }} + - uses: ./.github/workflows/actions/angular-test with: app: ${{ matrix.apps }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..7fc3f6fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,89 @@ +name: Release + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + Release: + name: 🚀 Release + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: ./.github/workflows/actions/setup + - uses: ./.github/workflows/actions/release-setup + with: + token: ${{ secrets.GITHUB_TOKEN }} + npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }} + + - uses: ./.github/workflows/actions/release-build + + # - name: Create Release Pull Request or Publish to npm + # id: changesets + # uses: changesets/action@v1 + # with: + # publish: npm run release + # env: + # HUSKY_DISABLED: 1 + # BAL_DS_RELEASE: true + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + + # - name: Echo Changeset output + # shell: bash + # run: | + # echo "Changeset published - ${{ steps.changesets.outputs.published }}" + # echo "Changeset publishedPackages - ${{ steps.changesets.outputs.publishedPackages }}" + # echo "Changeset hasChangesets - ${{ steps.changesets.outputs.hasChangesets }}" + # echo "Changeset pullRequestNumber - ${{ steps.changesets.outputs.pullRequestNumber }}" + + # - name: Update lock file + # if: steps.changesets.outputs.published == 'true' + # run: npm install + # shell: bash + + # - name: Commit lock file + # if: steps.changesets.outputs.published == 'true' + # uses: EndBug/add-and-commit@v9 + # with: + # add: 'package-lock.json' + # message: 'chore(): update lock file' + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Tag release + # if: steps.changesets.outputs.published == 'true' + # uses: thejeff77/action-push-tag@v1.0.0 + # with: + # tag: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' + # message: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' + + # - name: Update changelog file + # if: steps.changesets.outputs.published == 'true' + # run: awk 'NR==1 {print "# Changelog"} NR!=1' packages/components/CHANGELOG.md > CHANGELOG.md + # shell: bash + + # - name: Commit changelog + # if: steps.changesets.outputs.published == 'true' + # uses: EndBug/add-and-commit@v9 + # with: + # add: 'CHANGELOG.md' + # message: 'chore(): update changelog' + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Merge main -> production + # if: steps.changesets.outputs.published == 'true' + # uses: devmasx/merge-branch@master + # with: + # type: now + # from_branch: main + # target_branch: production + # message: ':bookmark: release: ${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' + # github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/project.json b/docs/project.json index 6c74dbff..5bd79a8e 100644 --- a/docs/project.json +++ b/docs/project.json @@ -50,5 +50,6 @@ "figmaTokensAssetPath": "packages/tokens/dist/figma" } } - } + }, + "tags": ["scope:docs", "type:docs"] } diff --git a/e2e/cypress/e2e/visual/bal-nav-menu-flyout.visual.cy.ts b/e2e/cypress/e2e/visual/bal-nav-menu-flyout.visual.cy.ts index cc9db413..17dd5695 100644 --- a/e2e/cypress/e2e/visual/bal-nav-menu-flyout.visual.cy.ts +++ b/e2e/cypress/e2e/visual/bal-nav-menu-flyout.visual.cy.ts @@ -47,7 +47,7 @@ describe('bal-nav-menu-flyout', () => { cy.platform('mobile') cy.testVisual('menu-flyout-mobile', { - errorThreshold: 0.2, + errorThreshold: 0.25, capture: 'viewport', clip: balViewport['mobile'], }) diff --git a/e2e/project.json b/e2e/project.json index 2852c97a..7b96dac1 100644 --- a/e2e/project.json +++ b/e2e/project.json @@ -37,5 +37,6 @@ "command": "echo done", "outputs": ["{options.outputFile}"] } - } + }, + "tags": ["scope:e2e", "scope:visual", "type:test"] } diff --git a/libs/nx/project.json b/libs/nx/project.json index 5f703ccd..100004f0 100644 --- a/libs/nx/project.json +++ b/libs/nx/project.json @@ -44,5 +44,5 @@ } } }, - "tags": [] + "tags": ["scope:dev", "type:lib"] } diff --git a/libs/output-target-angular/project.json b/libs/output-target-angular/project.json index 52e5b757..be86d861 100644 --- a/libs/output-target-angular/project.json +++ b/libs/output-target-angular/project.json @@ -22,5 +22,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "type:lib"] } diff --git a/libs/output-target-react/project.json b/libs/output-target-react/project.json index 7b03fb1c..538b944c 100644 --- a/libs/output-target-react/project.json +++ b/libs/output-target-react/project.json @@ -22,5 +22,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "type:lib"] } diff --git a/libs/output-target-vue/project.json b/libs/output-target-vue/project.json index 38db0c66..84f5e977 100644 --- a/libs/output-target-vue/project.json +++ b/libs/output-target-vue/project.json @@ -22,5 +22,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "type:lib"] } diff --git a/packages/angular-common/project.json b/packages/angular-common/project.json index 79db4e60..80882546 100644 --- a/packages/angular-common/project.json +++ b/packages/angular-common/project.json @@ -3,7 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/angular-common/src", "prefix": "bal", - "tags": [], "projectType": "library", "targets": { "build": { @@ -22,5 +21,6 @@ }, "defaultConfiguration": "production" } - } + }, + "tags": ["scope:release", "type:package"] } diff --git a/packages/angular-legacy/project.json b/packages/angular-legacy/project.json index eb048ad9..d875c4ca 100644 --- a/packages/angular-legacy/project.json +++ b/packages/angular-legacy/project.json @@ -3,7 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/angular-legacy/src", "prefix": "bal", - "tags": [], "projectType": "library", "targets": { "build": { @@ -23,5 +22,6 @@ }, "defaultConfiguration": "production" } - } + }, + "tags": ["scope:release", "type:package"] } diff --git a/packages/angular-module/project.json b/packages/angular-module/project.json index c854b1a6..757ce6d2 100644 --- a/packages/angular-module/project.json +++ b/packages/angular-module/project.json @@ -3,7 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/angular-module/src", "prefix": "bal", - "tags": [], "projectType": "library", "targets": { "build": { @@ -23,5 +22,6 @@ }, "defaultConfiguration": "production" } - } + }, + "tags": ["scope:release", "type:package"] } diff --git a/packages/angular/project.json b/packages/angular/project.json index fb7ba8d2..90d7695d 100644 --- a/packages/angular/project.json +++ b/packages/angular/project.json @@ -3,7 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/angular/src", "prefix": "lib", - "tags": [], "projectType": "library", "targets": { "build": { @@ -23,5 +22,6 @@ }, "defaultConfiguration": "production" } - } + }, + "tags": ["scope:release", "type:package"] } diff --git a/packages/brand-icons/project.json b/packages/brand-icons/project.json index 7962ad5c..76f7687d 100644 --- a/packages/brand-icons/project.json +++ b/packages/brand-icons/project.json @@ -76,5 +76,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/core/project.json b/packages/core/project.json index b71aae71..6a1cba87 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -34,5 +34,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/css/project.json b/packages/css/project.json index bb9d9d32..df8e518a 100644 --- a/packages/css/project.json +++ b/packages/css/project.json @@ -16,5 +16,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "type:package"] } diff --git a/packages/devkit/project.json b/packages/devkit/project.json index 3e29f1c8..87e9c2ab 100644 --- a/packages/devkit/project.json +++ b/packages/devkit/project.json @@ -15,5 +15,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "type:package"] } diff --git a/packages/favicons/project.json b/packages/favicons/project.json index 14b67c48..7e882fd5 100644 --- a/packages/favicons/project.json +++ b/packages/favicons/project.json @@ -6,5 +6,6 @@ "command": "eslint --no-eslintrc", "outputs": ["{options.outputFile}"] } - } + }, + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/fonts/project.json b/packages/fonts/project.json index 7d58079a..385a275b 100644 --- a/packages/fonts/project.json +++ b/packages/fonts/project.json @@ -6,5 +6,6 @@ "command": "eslint --no-eslintrc", "outputs": ["{options.outputFile}"] } - } + }, + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/icons/project.json b/packages/icons/project.json index 7fbb276f..1f8903bd 100644 --- a/packages/icons/project.json +++ b/packages/icons/project.json @@ -100,5 +100,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/maps/project.json b/packages/maps/project.json index 8ba32877..52bf091d 100644 --- a/packages/maps/project.json +++ b/packages/maps/project.json @@ -43,5 +43,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/react/project.json b/packages/react/project.json index 97cdd4f7..da30b7b4 100644 --- a/packages/react/project.json +++ b/packages/react/project.json @@ -3,6 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/react/src", "projectType": "library", - "tags": [], - "targets": {} + "targets": {}, + "tags": ["scope:release", "type:package"] } diff --git a/packages/styles/project.json b/packages/styles/project.json index c94179ae..ccd7da5a 100644 --- a/packages/styles/project.json +++ b/packages/styles/project.json @@ -13,5 +13,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/table/project.json b/packages/table/project.json index 8548c440..685a9401 100644 --- a/packages/table/project.json +++ b/packages/table/project.json @@ -18,5 +18,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "type:package"] } diff --git a/packages/testing/project.json b/packages/testing/project.json index 89f286da..7810b1a7 100644 --- a/packages/testing/project.json +++ b/packages/testing/project.json @@ -29,5 +29,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "scope:visual", "type:package"] } diff --git a/packages/tokens/project.json b/packages/tokens/project.json index 6201d534..b07eca6e 100644 --- a/packages/tokens/project.json +++ b/packages/tokens/project.json @@ -21,5 +21,5 @@ } } }, - "tags": [] + "tags": ["scope:release", "scope:docs", "type:package"] } diff --git a/packages/vue/project.json b/packages/vue/project.json index 30c83f39..b3b2e67e 100644 --- a/packages/vue/project.json +++ b/packages/vue/project.json @@ -3,6 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/vue/src", "projectType": "library", - "tags": [], - "targets": {} + "targets": {}, + "tags": ["scope:release", "type:package"] }