From 76c3643d26ef1f16168439085eeab58406c684ea Mon Sep 17 00:00:00 2001 From: Tyler Miller Date: Tue, 16 May 2023 07:36:52 -0700 Subject: [PATCH 1/7] ci: Get and update primer primitives automatically --- .github/workflows/update-colors.yml | 48 +++++++++++++++++++++++++++++ package.json | 6 ++++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/update-colors.yml create mode 100644 package.json diff --git a/.github/workflows/update-colors.yml b/.github/workflows/update-colors.yml new file mode 100644 index 00000000..4a87bf4d --- /dev/null +++ b/.github/workflows/update-colors.yml @@ -0,0 +1,48 @@ +name: Get/Update Primer Color Primitives + +env: + _DEST: '${{ github.workspace }}/lua/github-theme/palette/primitives' + _JSON_DIR: '${{ github.workspace }}/node_modules/@primer/primitives/dist/json/colors' + _LICENSE_GLOB: '${{ github.workspace }}/node_modules/@primer/primitives/[Ll][Ii][Cc][Ee][Nn][Ss][Ee]*' + +on: + workflow_dispatch: + schedule: + # 3x per week (every other day) at 12:40pm Pacific Time + cron: '40 19 * * 1,3,5' + +jobs: + get-colors: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + # with: + # cache: npm + + - run: npm i @primer/primitives@latest + + - run: | + set -u +f + shopt -s nocaseglob failglob + license="$(<$_LICENSE_GLOB)" + mkdir -p "$_DEST" + cd "$_JSON_DIR" + + for file in *.json; do + cat >"${_DEST_DIR}/${file%.json}.lua" < Date: Tue, 16 May 2023 09:35:19 -0700 Subject: [PATCH 2/7] Add `node_modules/` to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 73208f24..624c30df 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ doc/tags test/plenary .repro misc +node_modules/ From 46ab8a76b214608eca230a6a32f7ce9638b6afa8 Mon Sep 17 00:00:00 2001 From: Tyler Miller Date: Tue, 16 May 2023 09:46:28 -0700 Subject: [PATCH 3/7] Add package-lock.json --- package-lock.json | 20 ++++++++++++++++++++ package.json | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..7c7c475a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,20 @@ +{ + "name": "github-nvim-theme", + "version": "0.0.7", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "github-nvim-theme", + "version": "0.0.7", + "dependencies": { + "@primer/primitives": "^7.11.10" + } + }, + "node_modules/@primer/primitives": { + "version": "7.11.10", + "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-7.11.10.tgz", + "integrity": "sha512-KwChxyp4qbLojZx5Nz8RUElM9K+ObzZWvzkYEu76TC4qEsqb9wW7n78jyov5WhUh5+qj2Qac1iCsPfeTQG5YBw==" + } + } +} diff --git a/package.json b/package.json index 5a0994d3..506fe593 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,6 @@ { + "name": "github-nvim-theme", + "version": "0.0.7", "private": true, "dependencies": { "@primer/primitives": "^7.11.10" From 8b8deb7fefc988194f4a3ca262403ed6df71dee7 Mon Sep 17 00:00:00 2001 From: Tyler Miller Date: Tue, 16 May 2023 09:55:46 -0700 Subject: [PATCH 4/7] Fix workflow yaml --- .github/workflows/update-colors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-colors.yml b/.github/workflows/update-colors.yml index 4a87bf4d..d8815170 100644 --- a/.github/workflows/update-colors.yml +++ b/.github/workflows/update-colors.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: schedule: # 3x per week (every other day) at 12:40pm Pacific Time - cron: '40 19 * * 1,3,5' + - cron: '40 19 * * 1,3,5' jobs: get-colors: From de11df57a73ebdf6c254ef4546157fa7fac3126f Mon Sep 17 00:00:00 2001 From: Tyler Miller Date: Tue, 16 May 2023 10:10:48 -0700 Subject: [PATCH 5/7] Use node lts --- .github/workflows/update-colors.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-colors.yml b/.github/workflows/update-colors.yml index d8815170..02952b22 100644 --- a/.github/workflows/update-colors.yml +++ b/.github/workflows/update-colors.yml @@ -18,8 +18,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - # with: - # cache: npm + with: + node-version: lts + check-latest: true - run: npm i @primer/primitives@latest From 469da355aac0a6e28458e190d5892c657a098c1d Mon Sep 17 00:00:00 2001 From: Tyler Miller Date: Mon, 22 May 2023 09:23:24 -0700 Subject: [PATCH 6/7] Rm version, add primitives version, regen pkgfiles --- .github/workflows/update-colors.yml | 7 +++++++ package-lock.json | 2 -- package.json | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-colors.yml b/.github/workflows/update-colors.yml index 02952b22..6d67aa67 100644 --- a/.github/workflows/update-colors.yml +++ b/.github/workflows/update-colors.yml @@ -4,6 +4,7 @@ env: _DEST: '${{ github.workspace }}/lua/github-theme/palette/primitives' _JSON_DIR: '${{ github.workspace }}/node_modules/@primer/primitives/dist/json/colors' _LICENSE_GLOB: '${{ github.workspace }}/node_modules/@primer/primitives/[Ll][Ii][Cc][Ee][Nn][Ss][Ee]*' + _PRIMITIVES_PKGJSON: '${{ github.workspace }}/node_modules/@primer/primitives/package.json' on: workflow_dispatch: @@ -31,9 +32,15 @@ jobs: mkdir -p "$_DEST" cd "$_JSON_DIR" + if jq -e .version "$_PRIMITIVES_PKGJSON"; then + version="M._VERSION = vim.json.decode([=[$(jq -e .version "$_PRIMITIVES_PKGJSON")]=], { luanil = { object = false, array = false } })" + fi + for file in *.json; do cat >"${_DEST_DIR}/${file%.json}.lua" < Date: Mon, 22 May 2023 21:29:41 -0700 Subject: [PATCH 7/7] Fix typo: `DEST` -> `DEST_DIR` --- .github/workflows/update-colors.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-colors.yml b/.github/workflows/update-colors.yml index 6d67aa67..cb47edf8 100644 --- a/.github/workflows/update-colors.yml +++ b/.github/workflows/update-colors.yml @@ -1,7 +1,7 @@ name: Get/Update Primer Color Primitives env: - _DEST: '${{ github.workspace }}/lua/github-theme/palette/primitives' + _DEST_DIR: '${{ github.workspace }}/lua/github-theme/palette/primitives' _JSON_DIR: '${{ github.workspace }}/node_modules/@primer/primitives/dist/json/colors' _LICENSE_GLOB: '${{ github.workspace }}/node_modules/@primer/primitives/[Ll][Ii][Cc][Ee][Nn][Ss][Ee]*' _PRIMITIVES_PKGJSON: '${{ github.workspace }}/node_modules/@primer/primitives/package.json' @@ -29,7 +29,8 @@ jobs: set -u +f shopt -s nocaseglob failglob license="$(<$_LICENSE_GLOB)" - mkdir -p "$_DEST" + rm -r "$_DEST_DIR" || : + mkdir -p "$_DEST_DIR" cd "$_JSON_DIR" if jq -e .version "$_PRIMITIVES_PKGJSON"; then @@ -37,11 +38,12 @@ jobs: fi for file in *.json; do - cat >"${_DEST_DIR}/${file%.json}.lua" <|"${_DEST_DIR}/${file%.json}.lua" <