From 9fa92ac0f923dc06384af8d6e334affbedc45367 Mon Sep 17 00:00:00 2001 From: iCrawl Date: Sun, 17 Apr 2022 19:55:06 +0200 Subject: [PATCH] ci: extract package and semver from tag --- .github/workflows/documentation.yml | 23 +++++++++++++++++++++-- packages/builders/package.json | 2 +- packages/collection/package.json | 2 +- packages/rest/package.json | 2 +- packages/voice/package.json | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 2694d7235..e01ab7c05 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -82,13 +82,32 @@ jobs: token: ${{ secrets.DJS_DOCS }} path: 'out' + - name: 'Extract package from tag' + if: env.BRANCH_OR_TAG == 'tag' + id: package-name + uses: frabert/replace-string-action@v2.0 + with: + pattern: '(^@.*\\/(?.*)@v?)?(?\d+.\d+.\d+)-?.*' + string: ${{ env.BRANCH_NAME }} + replace-with: '$' + + - name: 'Extract semver from tag' + if: env.BRANCH_OR_TAG == 'tag' + id: semver + uses: frabert/replace-string-action@v2.0 + with: + pattern: '(^@.*\\/(?.*)@v?)?(?\d+.\d+.\d+)-?.*' + string: ${{ env.BRANCH_NAME }} + replace-with: '$' + - name: Move docs to correct directory if: env.BRANCH_OR_TAG == 'tag' env: - PACKAGE: ${{ matrix.package }} + PACKAGE: ${{ steps.package-name.outputs.replaced }} + SEMVER: ${{ steps.semver.outputs.replaced }} run: | mkdir -p out/${PACKAGE} - mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/$(jq --raw-output '.version' packages/${PACKAGE}/package.json).json + mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${SEMVER}.json - name: Move docs to correct directory if: env.BRANCH_OR_TAG == 'branch' diff --git a/packages/builders/package.json b/packages/builders/package.json index 33b19bdaf..827756aa2 100644 --- a/packages/builders/package.json +++ b/packages/builders/package.json @@ -1,6 +1,6 @@ { "name": "@discordjs/builders", - "version": "0.13.0", + "version": "0.14.0-dev", "description": "A set of builders that you can use when creating your bot", "scripts": { "build": "tsup", diff --git a/packages/collection/package.json b/packages/collection/package.json index 55fb69ddc..ecd254fa5 100644 --- a/packages/collection/package.json +++ b/packages/collection/package.json @@ -1,6 +1,6 @@ { "name": "@discordjs/collection", - "version": "0.6.0", + "version": "0.7.0-dev", "description": "Utility data structure used in discord.js", "scripts": { "test": "jest --pass-with-no-tests", diff --git a/packages/rest/package.json b/packages/rest/package.json index 0a9fbbeb2..66aa3f400 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -1,6 +1,6 @@ { "name": "@discordjs/rest", - "version": "0.4.0", + "version": "0.5.0-dev", "description": "The REST API for discord.js", "scripts": { "build": "tsup && tsc --emitDeclarationOnly --incremental", diff --git a/packages/voice/package.json b/packages/voice/package.json index b03c50655..89ba568eb 100644 --- a/packages/voice/package.json +++ b/packages/voice/package.json @@ -1,6 +1,6 @@ { "name": "@discordjs/voice", - "version": "0.9.0", + "version": "0.10.0-dev", "description": "Implementation of the Discord Voice API for node.js", "scripts": { "build": "tsup && node scripts/postbuild.mjs",