From 4d9aafdc071581b9866041df1c72dbc33ecb3c5c Mon Sep 17 00:00:00 2001 From: Jonathan Ho Date: Tue, 10 Jan 2023 01:45:48 +0800 Subject: [PATCH 1/4] Update release.yml --- .github/workflows/release.yml | 106 +++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9adca4575..0e6923c89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,34 +4,98 @@ on: push: branches: - main + - node-migration + path: + - packages/** + - .github/** jobs: + path-filter: + name: Check Path Changes + runs-on: ubuntu-latest + outputs: + bot: ${ steps.changes.outputs.bot } + gateway: ${ steps.changes.outputs.gateway } + rest: ${ steps.changes.outputs.rest } + types: ${ steps.changes.outputs.types } + utils: ${ steps.changes.outputs.utils } + global: ${ steps.changes.outputs.global } + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: changes + with: + base: node-migration + filters: | + bot: + - "packages/bot/**" + gateway: + - "packages/gateway/**" + rest: + - "packages/rest/**" + types: + - "packages/types/**" + utils: + - "packages/utils/**" + global: + - ".github/**" + publish: runs-on: ubuntu-latest + permissions: + contents: read + packages: write strategy: matrix: - deno: ["v1.x"] + package: ["bot", "gateway", "rest", "types", "utils"] + run: ["false"] + exclude: + - package: bot + run: "${{ needs.path-filter.outputs.bot == 'true' || needs.path-filter.outputs.global == 'true' }}" + - package: gateway + run: "${{ needs.path-filter.outputs.gateway == 'true' || needs.path-filter.outputs.global == 'true' }}" + - package: rest + run: "${{ needs.path-filter.outputs.rest == 'true' || needs.path-filter.outputs.global == 'true' }}" + - package: types + run: "${{ needs.path-filter.outputs.types == 'true' || needs.path-filter.outputs.global == 'true' }}" + - package: utils + run: "${{ needs.path-filter.outputs.utils == 'true' || needs.path-filter.outputs.global == 'true' }}" + needs: path-filter steps: - - uses: actions/checkout@v2 - - uses: denoland/setup-deno@main + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - deno-version: ${{ matrix.deno }} - - name: Get last tag version - run: | - echo "DISCORDENO_VERSION_OLD=$(wget -O- -q https://deno.land/x/discordeno/util/constants.ts | grep 'export const DISCORDENO_VERSION' | awk -F'= ' '{print $2}' | tr -d '"|;')" >> $GITHUB_ENV - - name: Get new tag version - run: echo "DISCORDENO_VERSION=$(cat util/constants.ts | grep 'export const DISCORDENO_VERSION' | awk -F'= ' '{print $2}' | tr -d '"|;')" >> $GITHUB_ENV - - name: Create tag - if: ${{ env.DISCORDENO_VERSION != env.DISCORDENO_VERSION_OLD }} - run: git tag ${{ env.DISCORDENO_VERSION }} && git push --tags - - uses: actions/setup-node@v2 + node-version: 18 + registry-url: "https://npm.pkg.github.com" + scope: "@discordeno" + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 with: - node-version: "16.x" - registry-url: "https://registry.npmjs.org" - - name: build npm - run: deno run -A ./dnt.ts ${{ env.DISCORDENO_VERSION }} - - name: npm publish - if: ${{ env.DISCORDENO_VERSION != env.DISCORDENO_VERSION_OLD }} + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - run: yarn install --immutable + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v3 + with: + path: .turbo + key: ${{ runner.os }}-turbo-release-build-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo-release-build- + - name: build Package + run: yarn release-build --cache-dir=".turbo" + - name: Bump Package Version + run: node ./scripts/bumpVersionByCommit.js ${{ matrix.package }} + - uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: "https://npm.pkg.github.com" + scope: "@discordeno" + - run: npm publish --access public + working-directory: packages/${{ matrix.package }} env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: cd npm && npm publish + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 223afdc07b54546e309708842a3ea7524fd46da0 Mon Sep 17 00:00:00 2001 From: Jonathan Ho Date: Tue, 10 Jan 2023 01:46:56 +0800 Subject: [PATCH 2/4] Update release.yml --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e6923c89..ddeeabe14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,8 @@ on: branches: - main - node-migration - path: + - node-migration-clean + paths: - packages/** - .github/** From fdb9540ddc36f480931e28f8ef795cdd61ed6bd8 Mon Sep 17 00:00:00 2001 From: Jonathan Ho Date: Mon, 9 Jan 2023 09:51:34 -0800 Subject: [PATCH 3/4] ci: add build filter --- .github/workflows/release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ddeeabe14..edbee15c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,11 +84,9 @@ jobs: uses: actions/cache@v3 with: path: .turbo - key: ${{ runner.os }}-turbo-release-build-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-turbo-release-build- + key: ${{ runner.os }}-turbo-release-build-${{ matrix.package }}-${{ github.sha }} - name: build Package - run: yarn release-build --cache-dir=".turbo" + run: yarn release-build --cache-dir=".turbo" --filter=./packages/${{ matrix.package }} - name: Bump Package Version run: node ./scripts/bumpVersionByCommit.js ${{ matrix.package }} - uses: actions/setup-node@v3 From 85dad7d043a7f64a184f620ae76a7d4f8dca3f04 Mon Sep 17 00:00:00 2001 From: Jonathan Ho Date: Mon, 9 Jan 2023 09:53:19 -0800 Subject: [PATCH 4/4] ci: fail fast false --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index edbee15c6..9314391fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,6 +47,7 @@ jobs: contents: read packages: write strategy: + fail-fast: false matrix: package: ["bot", "gateway", "rest", "types", "utils"] run: ["false"]