diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6d4d333be..29d8728ad 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -6,8 +6,6 @@ jobs: pr: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} - permissions: - packages: write steps: - name: Checkout all commits uses: actions/checkout@v3 @@ -18,12 +16,6 @@ jobs: uses: ./.github/actions/setup with: node_version: 19.5.0 - - uses: docker/setup-buildx-action@v2 - - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - name: Commit lint shell: bash run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} @@ -51,13 +43,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} ASSETS: ${{ github.workspace }}/assets - - name: Containers - shell: bash - run: npx nx affected --target=container --configuration=production --parallel=5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} - ASSETS: ${{ github.workspace }}/assets - name: Export shell: bash # issue with parallelism diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-main.yml similarity index 62% rename from .github/workflows/release-npm.yml rename to .github/workflows/release-main.yml index a4421cd94..a3c62a610 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-main.yml @@ -12,8 +12,10 @@ env: concurrency: commits-to-main jobs: - release-npm: + release-main: runs-on: ubuntu-latest + permissions: + packages: write steps: - name: Checkout all commits uses: actions/checkout@v3 @@ -23,23 +25,32 @@ jobs: uses: ./.github/actions/setup with: node_version: 19.5.0 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Workspace lint shell: bash run: npx nx workspace-lint - name: Lint shell: bash run: npx nx run-many --target=lint --all --parallel=5 - - name: Build + - name: Test + shell: bash + run: npx nx run-many --target=test --all --parallel=5 + - name: Build for publishing shell: bash # configuration ci will put the dists in each project directory so changesets can publish - run: npx nx run-many --target=build --configuration=ci --all --parallel=5 + # NOTE: changed from ci to production and added script for copy + run: npx nx run-many --target=build --configuration=production --all --parallel=5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} ASSETS: ${{ github.workspace }}/assets - - name: Test - shell: bash - run: npx nx run-many --target=test --all --parallel=5 + - name: Release + run: ./scripts/copy-dists-for-publishing.sh - name: Create Release Pull Request or Publish to NPM uses: changesets/action@v1 with: @@ -48,3 +59,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Containers + shell: bash + run: npx nx run-many --target=container --configuration=production -all --parallel=5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + ASSETS: ${{ github.workspace }}/assets diff --git a/apps/assets/project.json b/apps/assets/project.json index 876aace28..6d98d00ea 100644 --- a/apps/assets/project.json +++ b/apps/assets/project.json @@ -23,13 +23,6 @@ "extractLicenses": true, "sourceMap": false, "externalDependencies": "none" - }, - "ci": { - "outputPath": "apps/assets/dist", - "optimization": true, - "extractLicenses": true, - "sourceMap": false, - "externalDependencies": "none" } } }, diff --git a/apps/crons/project.json b/apps/crons/project.json index ddb6f504e..0810f923e 100644 --- a/apps/crons/project.json +++ b/apps/crons/project.json @@ -23,13 +23,6 @@ "extractLicenses": true, "sourceMap": false, "externalDependencies": "none" - }, - "ci": { - "outputPath": "apps/crons/dist", - "optimization": true, - "extractLicenses": true, - "sourceMap": false, - "externalDependencies": "none" } } }, diff --git a/apps/explorer/project.json b/apps/explorer/project.json index 1ab8f0171..10d3333d7 100644 --- a/apps/explorer/project.json +++ b/apps/explorer/project.json @@ -42,9 +42,6 @@ "with": "apps/explorer/config/testnet-zen.ts" } ] - }, - "ci": { - "outputPath": "apps/explorer/dist" } } }, diff --git a/apps/hostd/project.json b/apps/hostd/project.json index 7bc25b98c..6aa7e0da5 100644 --- a/apps/hostd/project.json +++ b/apps/hostd/project.json @@ -6,9 +6,7 @@ "targets": { "build": { "executor": "@nx/next:build", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "defaultConfiguration": "production", "options": { "outputPath": "dist/apps/hostd", @@ -18,9 +16,6 @@ "development": {}, "production": {}, "local": {}, - "ci": { - "outputPath": "apps/hostd/dist" - }, "export": { "outputPath": "dist/apps/hostd-export", "fileReplacements": [ @@ -52,9 +47,7 @@ }, "container": { "executor": "@nx-tools/nx-container:build", - "dependsOn": [ - "build" - ], + "dependsOn": ["build"], "defaultConfiguration": "local", "options": { "engine": "docker", @@ -63,24 +56,18 @@ }, "configurations": { "local": { - "tags": [ - "siafoundation/web-hostd:latest" - ], + "tags": ["siafoundation/web-hostd:latest"], "push": false }, "production": { - "tags": [ - "ghcr.io/siafoundation/web-hostd:latest" - ], + "tags": ["ghcr.io/siafoundation/web-hostd:latest"], "push": true } } }, "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/apps/hostd" - ], + "outputs": ["{workspaceRoot}/coverage/apps/hostd"], "options": { "jestConfig": "apps/hostd/jest.config.ts", "passWithNoTests": true @@ -88,13 +75,9 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": [ - "{options.outputFile}" - ], + "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": [ - "apps/hostd/**/*.{ts,tsx,js,jsx}" - ] + "lintFilePatterns": ["apps/hostd/**/*.{ts,tsx,js,jsx}"] } } }, diff --git a/apps/renterd/project.json b/apps/renterd/project.json index 0b1943589..9f8ca5050 100644 --- a/apps/renterd/project.json +++ b/apps/renterd/project.json @@ -16,9 +16,6 @@ "development": {}, "production": {}, "local": {}, - "ci": { - "outputPath": "apps/renterd/dist" - }, "export": { "outputPath": "dist/apps/renterd-export", "fileReplacements": [ diff --git a/apps/walletd/project.json b/apps/walletd/project.json index 0f0bc45f2..fbb4dd6da 100644 --- a/apps/walletd/project.json +++ b/apps/walletd/project.json @@ -15,9 +15,6 @@ "development": {}, "production": {}, "local": {}, - "ci": { - "outputPath": "apps/walletd/dist" - }, "export": { "outputPath": "dist/apps/walletd-export", "fileReplacements": [ diff --git a/apps/website/project.json b/apps/website/project.json index ec1b191c6..5629c77ff 100644 --- a/apps/website/project.json +++ b/apps/website/project.json @@ -6,9 +6,7 @@ "targets": { "build": { "executor": "@nx/next:build", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "defaultConfiguration": "production", "options": { "outputPath": "dist/apps/website", @@ -23,10 +21,7 @@ }, "configurations": { "development": {}, - "production": {}, - "ci": { - "outputPath": "apps/website/dist" - } + "production": {} } }, "serve": { @@ -51,9 +46,7 @@ }, "container": { "executor": "@nx-tools/nx-container:build", - "dependsOn": [ - "build" - ], + "dependsOn": ["build"], "defaultConfiguration": "local", "options": { "engine": "docker", @@ -62,24 +55,18 @@ }, "configurations": { "local": { - "tags": [ - "siafoundation/web-website:latest" - ], + "tags": ["siafoundation/web-website:latest"], "push": false }, "production": { - "tags": [ - "ghcr.io/siafoundation/web-website:latest" - ], + "tags": ["ghcr.io/siafoundation/web-website:latest"], "push": true } } }, "test": { "executor": "@nx/jest:jest", - "outputs": [ - "{workspaceRoot}/coverage/apps/website" - ], + "outputs": ["{workspaceRoot}/coverage/apps/website"], "options": { "jestConfig": "apps/website/jest.config.ts", "passWithNoTests": true @@ -87,13 +74,9 @@ }, "lint": { "executor": "@nx/linter:eslint", - "outputs": [ - "{options.outputFile}" - ], + "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": [ - "apps/website/**/*.{ts,tsx,js,jsx}" - ] + "lintFilePatterns": ["apps/website/**/*.{ts,tsx,js,jsx}"] } } }, diff --git a/libs/design-system/project.json b/libs/design-system/project.json index 13309981f..43ffa9f9d 100644 --- a/libs/design-system/project.json +++ b/libs/design-system/project.json @@ -29,11 +29,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/design-system/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/react-core/project.json b/libs/react-core/project.json index 8ae6f424e..1680c164f 100644 --- a/libs/react-core/project.json +++ b/libs/react-core/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/react-core/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/react-hostd/project.json b/libs/react-hostd/project.json index 95486593e..1087c7e85 100644 --- a/libs/react-hostd/project.json +++ b/libs/react-hostd/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/react-hostd/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/react-icons/project.json b/libs/react-icons/project.json index 0ce44f782..61149f750 100644 --- a/libs/react-icons/project.json +++ b/libs/react-icons/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/react-icons/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/react-renterd/project.json b/libs/react-renterd/project.json index 935d232b5..c4aef1391 100644 --- a/libs/react-renterd/project.json +++ b/libs/react-renterd/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/react-renterd/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/react-sia-central/project.json b/libs/react-sia-central/project.json index 856d376d7..07e1197a4 100644 --- a/libs/react-sia-central/project.json +++ b/libs/react-sia-central/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/react-sia-central/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/react-walletd/project.json b/libs/react-walletd/project.json index 42c1e0890..a54bd69de 100644 --- a/libs/react-walletd/project.json +++ b/libs/react-walletd/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/react-walletd/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/sia-central/project.json b/libs/sia-central/project.json index fbb081b1e..77dc910a8 100644 --- a/libs/sia-central/project.json +++ b/libs/sia-central/project.json @@ -24,11 +24,7 @@ } ] }, - "configurations": { - "ci": { - "outputPath": "libs/sia-central/dist" - } - } + "configurations": {} }, "lint": { "executor": "@nx/linter:eslint", diff --git a/libs/sia-js/project.json b/libs/sia-js/project.json index ed7a2cfd7..330470ac3 100644 --- a/libs/sia-js/project.json +++ b/libs/sia-js/project.json @@ -30,11 +30,7 @@ "assets": ["libs/sia-js/*.md"], "updateBuildableProjectDepsInPackageJson": true }, - "configurations": { - "ci": { - "outputPath": "libs/sia-js/dist" - } - } + "configurations": {} } }, "tags": [] diff --git a/libs/sia-nodejs/project.json b/libs/sia-nodejs/project.json index fd2d7a45e..53259fce3 100644 --- a/libs/sia-nodejs/project.json +++ b/libs/sia-nodejs/project.json @@ -30,11 +30,7 @@ "assets": ["libs/sia-nodejs/*.md"], "updateBuildableProjectDepsInPackageJson": true }, - "configurations": { - "ci": { - "outputPath": "libs/sia-nodejs/dist" - } - } + "configurations": {} } }, "tags": [] diff --git a/scripts/copy-dists-for-publishing.sh b/scripts/copy-dists-for-publishing.sh new file mode 100755 index 000000000..1c6b26526 --- /dev/null +++ b/scripts/copy-dists-for-publishing.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# from: +# dist/apps/renterd/ +# dist/apps/hostd/ +# dist/libs/react-renterd/ +# dist/libs/design-system/ +# to: +# apps/renterd/dist/ +# apps/hostd/dist/ +# libs/react-renterd/dist/ +# libs/design-system/dist/ + +for dir in dist/apps/* dist/libs/*; do + targetDir="${dir#dist/}" + if [ -d "$targetDir" ]; then + mkdir -p "$targetDir/dist" + cp -rv "$dir"/* "$targetDir/dist/" + fi +done + +# reverse +# for dir in apps/* libs/*; do +# sourceDir="$dir/dist" +# targetDir="dist/${dir}" +# if [ -d "$sourceDir" ]; then +# mkdir -p "$targetDir" +# cp -rv "$sourceDir"/* "$targetDir/" +# fi +# done