From 331d2c0f7e7a13950711dabb7aecdc1d71cfffbe Mon Sep 17 00:00:00 2001 From: Bhargav Ponnapalli Date: Wed, 18 Dec 2019 11:47:15 +0530 Subject: [PATCH] Update workflow and docusaurus --- .github/actions/get-latest-tag/action.yml | 13 +++++++++++++ .github/actions/get-latest-tag/main.js | 17 +++++++++++++++++ .../actions/get-latest-tag/package-lock.json | 13 +++++++++++++ .github/actions/get-latest-tag/package.json | 9 +++++++++ .github/workflows/canary.yml | 5 ++++- 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/actions/get-latest-tag/action.yml create mode 100644 .github/actions/get-latest-tag/main.js create mode 100644 .github/actions/get-latest-tag/package-lock.json create mode 100644 .github/actions/get-latest-tag/package.json diff --git a/.github/actions/get-latest-tag/action.yml b/.github/actions/get-latest-tag/action.yml new file mode 100644 index 0000000000..4161776da9 --- /dev/null +++ b/.github/actions/get-latest-tag/action.yml @@ -0,0 +1,13 @@ +name: Get latest tag +description: Gets the latest tag + +outputs: + latest: + description: The latest tag + +runs: + using: node12 + main: main.js + +branding: + icon: label diff --git a/.github/actions/get-latest-tag/main.js b/.github/actions/get-latest-tag/main.js new file mode 100644 index 0000000000..3d4d761a18 --- /dev/null +++ b/.github/actions/get-latest-tag/main.js @@ -0,0 +1,17 @@ +const cp = require("child_process"); +cp.execSync(`cd ${__dirname}; npm ci`); + +const core = require("@actions/core"); + +const exec = cmd => + cp + .execSync(cmd) + .toString() + .trim(); + +exec(`git fetch --tags`); + +const latesetTag = exec( + `git describe --abbrev=0 --tags ${process.env.GITHUB_SHA}` +); +core.setOutput("latest", latesetTag); diff --git a/.github/actions/get-latest-tag/package-lock.json b/.github/actions/get-latest-tag/package-lock.json new file mode 100644 index 0000000000..2fd93e780c --- /dev/null +++ b/.github/actions/get-latest-tag/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "get-release-tags", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@actions/core": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz", + "integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==" + } + } +} diff --git a/.github/actions/get-latest-tag/package.json b/.github/actions/get-latest-tag/package.json new file mode 100644 index 0000000000..f52f592129 --- /dev/null +++ b/.github/actions/get-latest-tag/package.json @@ -0,0 +1,9 @@ +{ + "private": true, + "name": "get-latest-tag", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@actions/core": "^1.1.0" + } +} \ No newline at end of file diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index ff3626fc2d..f984028ac0 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -32,8 +32,11 @@ jobs: run: yarn run readme-to-docs - name: Build docusaurus run: cd packages/docusaurus && yarn build + - name: Get latest tag info + id: latestTag + uses: ./.github/actions/get-latest-tag - name: Version docusaurus - run: cd packages/docusaurus && yarn run docs-version $GITHUB_REF + run: cd packages/docusaurus && yarn run docs-version ${{steps.latestTag.outputs.latest}} - name: Commit docusaurus run: | git add packages/docusaurus