Skip to content

Commit

Permalink
ci: extract package and semver from tag
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Apr 17, 2022
1 parent 2c2f88c commit 9fa92ac
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: '(^@.*\\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*'
string: ${{ env.BRANCH_NAME }}
replace-with: '$<package>'

- name: 'Extract semver from tag'
if: env.BRANCH_OR_TAG == 'tag'
id: semver
uses: frabert/replace-string-action@v2.0
with:
pattern: '(^@.*\\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*'
string: ${{ env.BRANCH_NAME }}
replace-with: '$<semver>'

- 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'
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/collection/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/voice/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 9fa92ac

Please sign in to comment.