-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Docs | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run | ||
run: sh ./scripts/update_docs/update_docs.sh | ||
env: | ||
EMAIL_ADDRESS: ${{secrets.EMAIL_ADDRESS}} | ||
GIT_NAME: ${{secrets.GIT_NAME}} | ||
PUBLIC_REPO_TOKEN: ${{secrets.PUBLIC_REPO_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Unpublish | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Set npmrc | ||
run: echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > ~/.npmrc | ||
env: | ||
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | ||
- name: Unpublish | ||
run: node ./scripts/unpublish/unpublish.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const jsnpm = require('jsnpm'); | ||
|
||
const logger = require('../../../util/logger'); | ||
|
||
const TAG_DEV = 'dev'; | ||
const TAG_NEXT = 'next'; | ||
const VERSION_REGEXP = new RegExp([TAG_NEXT, TAG_DEV].join('|')); | ||
|
||
const unpublish = async packageName => { | ||
const versions = await jsnpm.versions(packageName); | ||
const taggedNext = await jsnpm.getVersion(packageName, TAG_NEXT); | ||
const taggedDev = await jsnpm.getVersion(packageName, TAG_DEV); | ||
|
||
const nextOnly = versions.filter(v => { | ||
if ([taggedNext, taggedDev].includes(v)) { | ||
return false; | ||
} | ||
|
||
return !!v.match(VERSION_REGEXP); | ||
}); | ||
|
||
const one = async (i = 0) => { | ||
const current = nextOnly[i]; | ||
|
||
if (!current) { | ||
return; | ||
} | ||
|
||
logger.log(`Unpublishing: ${packageName}@${current}`); | ||
|
||
try { | ||
await jsnpm.unpublish(packageName, current); | ||
} catch (e) { | ||
logger.log(`Unable to unpublish: ${current}`, e); | ||
} | ||
|
||
one(++i); | ||
}; | ||
|
||
one(); | ||
}; | ||
|
||
const runUnpublish = async () => { | ||
await unpublish('vest'); | ||
await unpublish('eslint-plugin-vest'); | ||
await unpublish('n4s'); | ||
}; | ||
|
||
runUnpublish(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
git config --global user.email $EMAIL_ADDRESS --replace-all | ||
git config --global user.name $GIT_NAME | ||
|
||
echo "Cloning Source repo" | ||
git clone --single-branch --branch stable https://github.com/$GIT_NAME/vest.git | ||
|
||
echo "Cloning docs branches" | ||
git clone --single-branch --branch gh-pages https://github.com/$GIT_NAME/vest.git vest_docs | ||
git clone --single-branch --branch gh-pages https://github.com/$GIT_NAME/n4s.git n4s_docs | ||
|
||
echo "Retrieving Versions" | ||
cd ./vest/packages/vest | ||
export VEST_VERSION=$(node -pe "require('./package.json').version") | ||
echo "VEST: $VEST_VERSION" | ||
|
||
cd ../n4s | ||
export N4S_VERSION=$(node -pe "require('./package.json').version") | ||
echo "N4S: $N4S_VERSION" | ||
|
||
cd $GITHUB_WORKSPACE | ||
|
||
echo "Copying docs over" | ||
cp -a ./vest/packages/vest/docs/. vest_docs/ | ||
cp -a ./vest/packages/n4s/docs/. n4s_docs/ | ||
|
||
cd vest_docs | ||
git add . | ||
git commit -m "$VEST_VERSION" | ||
git push https://$PUBLIC_REPO_TOKEN@github.com/$GIT_NAME/vest.git gh-pages | ||
|
||
cd $GITHUB_WORKSPACE | ||
|
||
cd n4s_docs | ||
git add . | ||
git commit -m "$N4S_VERSION" | ||
git push https://$PUBLIC_REPO_TOKEN@github.com/$GIT_NAME/n4s.git gh-pages |