From 31be78cf6a0919a145d4d907da29b5bd22aa11e7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 13:51:26 +0100 Subject: [PATCH 01/30] Test --- .github/workflows/npm-publish.yml | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 8d03131..8c8966c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -17,19 +17,31 @@ jobs: with: node-version: 20 registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run make - - name: Publish NPM package (regular) - if: "!github.event.release.prerelease" - run: | - npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + # - name: Publish NPM package (regular) + # if: "!github.event.release.prerelease" + # run: | + # npm publish + # env: + # NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + # - name: Publish NPM package (pre-release) + # if: "github.event.release.prerelease" + # run: | + # npm publish --tag next + # env: + # NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + - name: Checkout CDN repo + uses: actions/checkout@v4 + with: + repository: maptiler/cdn.maptiler.com + path: target-repo - - name: Publish NPM package (pre-release) - if: "github.event.release.prerelease" + - name: List files in target-repo run: | - npm publish --tag next - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + ls -la target-repo From 92df0b51c860a06b8916e6b965567425c322e2bb Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 13:54:14 +0100 Subject: [PATCH 02/30] Test --- .github/workflows/npm-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 8c8966c..ecee9cc 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -3,6 +3,7 @@ name: Node.js Package on: release: types: [created] + workflow_dispatch: jobs: build-and-publish: @@ -19,7 +20,7 @@ jobs: registry-url: https://registry.npmjs.org/ - run: npm ci - + - run: npm run make # - name: Publish NPM package (regular) From 88049ed13262ed5dbd1aacba602567f091477101 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 13:56:24 +0100 Subject: [PATCH 03/30] Test --- .github/workflows/npm-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index ecee9cc..b7d0c5c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,9 +1,11 @@ name: Node.js Package on: + push: + branches: + - "RD-637_gh-action-cdn-release" release: types: [created] - workflow_dispatch: jobs: build-and-publish: From 9fa2e9d9a35048e23dc05cec1e9ed8471b9d1372 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:06:32 +0100 Subject: [PATCH 04/30] Test --- .github/workflows/npm-publish.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b7d0c5c..74189fe 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -10,6 +10,11 @@ on: jobs: build-and-publish: runs-on: ubuntu-latest + env: + CDN_MODULE_NAME: "maptiler-ar-control" + CDN_VERSION: "v.test" + CDN_REPO: "maptiler/cdn.maptiler.com" + CDN_REPO_BRANCH: "maptiler-ar-control-test" steps: - name: Checkout repo uses: actions/checkout@v4 @@ -42,9 +47,14 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: maptiler/cdn.maptiler.com - path: target-repo + repository: CDN_REPO + path: cdn - name: List files in target-repo run: | - ls -la target-repo + cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + cd cdn + git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" + git add . + git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" + git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file From 39264ce8151bf012d7693d4adbc8079bd5c57226 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:08:15 +0100 Subject: [PATCH 05/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 74189fe..6f6dbe1 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -47,7 +47,7 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: CDN_REPO + repository: "${CDN_REPO}" path: cdn - name: List files in target-repo From 0605865921bf5edf7e53af734b02ca7cc27e1236 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:09:29 +0100 Subject: [PATCH 06/30] Test --- .github/workflows/npm-publish.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 6f6dbe1..89fad3a 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -47,14 +47,15 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: "${CDN_REPO}" + repository: "maptiler/cdn.maptiler.com" path: cdn - name: List files in target-repo run: | - cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} - cd cdn - git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" - git add . - git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" - git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file + ls -la cdn + # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + # cd cdn + # git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" + # git add . + # git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" + # git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file From 23ae9ae0c3c63a48210beb861a73b66660047ebf Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:10:59 +0100 Subject: [PATCH 07/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 89fad3a..486645e 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -47,7 +47,7 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: "maptiler/cdn.maptiler.com" + repository: $CDN_REPO path: cdn - name: List files in target-repo From ced47eeb3015263899c9e441cd3d0066eaf2f317 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:12:43 +0100 Subject: [PATCH 08/30] Test --- .github/workflows/npm-publish.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 486645e..2a5cf38 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -7,14 +7,15 @@ on: release: types: [created] +env: + CDN_MODULE_NAME: "maptiler-ar-control" + CDN_VERSION: "v.test" + CDN_REPO: "maptiler/cdn.maptiler.com" + CDN_REPO_BRANCH: "maptiler-ar-control-test" + jobs: build-and-publish: runs-on: ubuntu-latest - env: - CDN_MODULE_NAME: "maptiler-ar-control" - CDN_VERSION: "v.test" - CDN_REPO: "maptiler/cdn.maptiler.com" - CDN_REPO_BRANCH: "maptiler-ar-control-test" steps: - name: Checkout repo uses: actions/checkout@v4 From 304a4eeb58be78e9b61c91de7b946e91b7cf3397 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:13:48 +0100 Subject: [PATCH 09/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 2a5cf38..fe2e9fb 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -48,7 +48,7 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: $CDN_REPO + repository: ${{ CDN_REPO }} path: cdn - name: List files in target-repo From 8352672ecf04d76bcad6a52fa55fa76f80b1ab4e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:14:45 +0100 Subject: [PATCH 10/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index fe2e9fb..eb9b5ee 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -48,7 +48,7 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: ${{ CDN_REPO }} + repository: "$CDN_REPO" path: cdn - name: List files in target-repo From 44197087b28cb670b3ae409c0ddd6bb19ce1b1a2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:17:55 +0100 Subject: [PATCH 11/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index eb9b5ee..4c18d85 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -48,7 +48,7 @@ jobs: - name: Checkout CDN repo uses: actions/checkout@v4 with: - repository: "$CDN_REPO" + repository: ${{ env.CDN_REPO }} path: cdn - name: List files in target-repo From 84343554840ad581b6791d04d15ca8a773a410bf Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:19:13 +0100 Subject: [PATCH 12/30] Test --- .github/workflows/npm-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 4c18d85..f34405e 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -53,8 +53,8 @@ jobs: - name: List files in target-repo run: | - ls -la cdn - # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + ls -la cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cd cdn # git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" # git add . From ec484b23f4d459508fd51ba563ad72e519954616 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:21:07 +0100 Subject: [PATCH 13/30] Test --- .github/workflows/npm-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index f34405e..3ba2295 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -53,6 +53,7 @@ jobs: - name: List files in target-repo run: | + mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} ls -la cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cd cdn From 1be19bc4b3e8a3bf15a7810c726a8fd5ca28b102 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:23:36 +0100 Subject: [PATCH 14/30] Test --- .github/workflows/npm-publish.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 3ba2295..c0aa7b3 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -45,6 +45,13 @@ jobs: # env: # NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - name: Check if target directory exists and abort if it does + run: | + if [ -d "cdn/${CDN_MODULE_NAME}/${CDN_VERSION}" ]; then + echo "Directory cdn/${CDN_MODULE_NAME}/${CDN_VERSION} already exists. Aborting." + exit 1 + fi + - name: Checkout CDN repo uses: actions/checkout@v4 with: @@ -55,9 +62,8 @@ jobs: run: | mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} - ls -la cdn/${CDN_MODULE_NAME}/${CDN_VERSION} - # cd cdn - # git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" - # git add . - # git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" - # git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file + cd cdn + git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" + git add . + git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" + git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file From 4575dd604004e1e25e2d085e4471f35b827ddeb7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:26:10 +0100 Subject: [PATCH 15/30] Test --- .github/workflows/npm-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index c0aa7b3..1332db8 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -63,6 +63,8 @@ jobs: mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} cd cdn + git config user.name "github-actions" + git config user.email "github-actions@github.com" git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" git add . git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" From 9b07cbe17315492e2eb6bee15448bd46067d1cf7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 14:34:37 +0100 Subject: [PATCH 16/30] Test --- .github/workflows/npm-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 1332db8..2b5d9f8 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -56,10 +56,12 @@ jobs: uses: actions/checkout@v4 with: repository: ${{ env.CDN_REPO }} + token: "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" path: cdn - name: List files in target-repo run: | + echo $npm_package_version mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} cd cdn From e94815c80d4712c7197fc12d8f2ac8a77745ef1d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 18:33:38 +0100 Subject: [PATCH 17/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 2b5d9f8..0b3065d 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -56,7 +56,7 @@ jobs: uses: actions/checkout@v4 with: repository: ${{ env.CDN_REPO }} - token: "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" + token: "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" path: cdn - name: List files in target-repo From 3e4dac2e879d04cece863d4b4997fb70c855c22e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 18:57:40 +0100 Subject: [PATCH 18/30] Test --- .github/release.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..7aa8ef7 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,11 @@ +changelog: + categories: + - title: 🏕 Features + labels: + - '*' + exclude: + labels: + - dependencies + - title: 👒 Dependencies + labels: + - dependencies From e7213f1ec5c7a969ff3762b0e13d803a9a4ec907 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 19:04:27 +0100 Subject: [PATCH 19/30] Test --- .github/release.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 7aa8ef7..d8371a2 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,11 +1,19 @@ changelog: + exclude: + labels: + - skip-changelog + authors: + - dependabot[bot] categories: - - title: 🏕 Features + - title: 🚀 Features labels: - - '*' - exclude: - labels: - - dependencies - - title: 👒 Dependencies + - feature + - title: 🐛 Bug Fixes labels: - - dependencies + - bug + - title: 🚀 Breaking Changes + labels: + - breaking-change + - title: Other Changes + labels: + - "*" # Catch-all for pull requests that didn't match any of the previous categories \ No newline at end of file From d60bc40ec7193fefb063916a1434217c13d9768f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 26 Feb 2025 19:12:10 +0100 Subject: [PATCH 20/30] Test --- .github/release.yml | 19 ------------------- .github/workflows/npm-publish.yml | 1 - 2 files changed, 20 deletions(-) delete mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index d8371a2..0000000 --- a/.github/release.yml +++ /dev/null @@ -1,19 +0,0 @@ -changelog: - exclude: - labels: - - skip-changelog - authors: - - dependabot[bot] - categories: - - title: 🚀 Features - labels: - - feature - - title: 🐛 Bug Fixes - labels: - - bug - - title: 🚀 Breaking Changes - labels: - - breaking-change - - title: Other Changes - labels: - - "*" # Catch-all for pull requests that didn't match any of the previous categories \ No newline at end of file diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 0b3065d..d5e55cb 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -56,7 +56,6 @@ jobs: uses: actions/checkout@v4 with: repository: ${{ env.CDN_REPO }} - token: "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" path: cdn - name: List files in target-repo From 09cc37c24fa1adc51bcf7a3eef2787074677ea34 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:23:06 +0100 Subject: [PATCH 21/30] Test --- .github/workflows/npm-publish.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index d5e55cb..050a168 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -60,13 +60,13 @@ jobs: - name: List files in target-repo run: | - echo $npm_package_version - mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} - cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} - cd cdn - git config user.name "github-actions" - git config user.email "github-actions@github.com" - git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" - git add . - git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" - git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file + node -p "require('./package.json').version" + # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + # cd cdn + # git config user.name "github-actions" + # git config user.email "github-actions@github.com" + # git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" + # git add . + # git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" + # git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file From 3e0d50e30ce5a4e39aac0643268afbe3878abffa Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:26:19 +0100 Subject: [PATCH 22/30] Test --- .github/workflows/npm-publish.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 050a168..275fa67 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -30,6 +30,9 @@ jobs: - run: npm ci - run: npm run make + + - name: Get package version + run: echo "PACKAGE_VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV # - name: Publish NPM package (regular) # if: "!github.event.release.prerelease" @@ -60,7 +63,7 @@ jobs: - name: List files in target-repo run: | - node -p "require('./package.json').version" + run: echo "Package version is $PACKAGE_VERSION" # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cd cdn From 7818318af19a37a35f4a536c3d15a7b7b31ecf35 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:27:52 +0100 Subject: [PATCH 23/30] Test --- .github/workflows/npm-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 275fa67..1f30cc3 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -63,7 +63,9 @@ jobs: - name: List files in target-repo run: | - run: echo "Package version is $PACKAGE_VERSION" + # REPO_NAME=${GITHUB_REPOSITORY##*/} + echo "Repository name: $GITHUB_REPOSITORY" + echo "Package version is $PACKAGE_VERSION" # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cd cdn From d6afd218c4e8f439a4c1885bc0eee2d25c627663 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:29:19 +0100 Subject: [PATCH 24/30] Test --- .github/workflows/npm-publish.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 1f30cc3..1a4207a 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -63,9 +63,7 @@ jobs: - name: List files in target-repo run: | - # REPO_NAME=${GITHUB_REPOSITORY##*/} - echo "Repository name: $GITHUB_REPOSITORY" - echo "Package version is $PACKAGE_VERSION" + node -p "require('./package.json').version" # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cd cdn From b27d97ec4b23b62636daa23307e938be3d79342e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:30:59 +0100 Subject: [PATCH 25/30] Test --- .github/workflows/npm-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 1a4207a..b472d92 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -32,7 +32,9 @@ jobs: - run: npm run make - name: Get package version - run: echo "PACKAGE_VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV + run: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV # - name: Publish NPM package (regular) # if: "!github.event.release.prerelease" From f89a2390cdb22d924bd2661940197277a9dfa1a1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:32:54 +0100 Subject: [PATCH 26/30] Test --- .github/workflows/npm-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b472d92..3f321cd 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -65,7 +65,9 @@ jobs: - name: List files in target-repo run: | - node -p "require('./package.json').version" + # REPO_NAME=${GITHUB_REPOSITORY##*/} + echo "Repository name: $GITHUB_REPOSITORY" + echo "Package version is $PACKAGE_VERSION" # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cd cdn From 3671bd28fbe7f2241626aa24eaa6979b4a885bc1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:35:20 +0100 Subject: [PATCH 27/30] Test --- .github/workflows/npm-publish.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 3f321cd..484ec3b 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -31,7 +31,12 @@ jobs: - run: npm run make - - name: Get package version + - name: Extract repository name + run: | + REPO_NAME=${GITHUB_REPOSITORY##*/} + echo "Repository name is $REPO_NAME" + + - name: Extract package version run: | PACKAGE_VERSION=$(node -p "require('./package.json').version") echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV @@ -65,8 +70,7 @@ jobs: - name: List files in target-repo run: | - # REPO_NAME=${GITHUB_REPOSITORY##*/} - echo "Repository name: $GITHUB_REPOSITORY" + echo "Repository name: $REPO_NAME" echo "Package version is $PACKAGE_VERSION" # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} From b9c22f437a07171b1f1af0ccc428c87a7e3452b7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 10:36:32 +0100 Subject: [PATCH 28/30] Test --- .github/workflows/npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 484ec3b..aae42fb 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -34,7 +34,7 @@ jobs: - name: Extract repository name run: | REPO_NAME=${GITHUB_REPOSITORY##*/} - echo "Repository name is $REPO_NAME" + echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV - name: Extract package version run: | From 07008bc61b4552d31bf2d68719324d64aa8e00e8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 27 Feb 2025 19:04:27 +0100 Subject: [PATCH 29/30] Test --- .github/workflows/npm-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index aae42fb..ae2d103 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -68,7 +68,7 @@ jobs: repository: ${{ env.CDN_REPO }} path: cdn - - name: List files in target-repo + - name: Push to CDN run: | echo "Repository name: $REPO_NAME" echo "Package version is $PACKAGE_VERSION" @@ -80,4 +80,5 @@ jobs: # git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" # git add . # git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" - # git push origin "${CDN_REPO_BRANCH}" \ No newline at end of file + # git push origin "${CDN_REPO_BRANCH}" + # ... pull-request here ... From 1fb1fe5aeb445db4c7d23aaf3ba7d52ad33c08bb Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 28 Feb 2025 09:43:41 +0100 Subject: [PATCH 30/30] Add comments --- .github/workflows/npm-publish.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index ae2d103..35213a9 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,8 +8,6 @@ on: types: [created] env: - CDN_MODULE_NAME: "maptiler-ar-control" - CDN_VERSION: "v.test" CDN_REPO: "maptiler/cdn.maptiler.com" CDN_REPO_BRANCH: "maptiler-ar-control-test" @@ -57,8 +55,8 @@ jobs: - name: Check if target directory exists and abort if it does run: | - if [ -d "cdn/${CDN_MODULE_NAME}/${CDN_VERSION}" ]; then - echo "Directory cdn/${CDN_MODULE_NAME}/${CDN_VERSION} already exists. Aborting." + if [ -d "cdn/${REPO_NAME}/${PACKAGE_VERSION}" ]; then + echo "Directory cdn/${REPO_NAME}/${PACKAGE_VERSION} already exists. Aborting." exit 1 fi @@ -67,18 +65,28 @@ jobs: with: repository: ${{ env.CDN_REPO }} path: cdn + # key here - name: Push to CDN run: | echo "Repository name: $REPO_NAME" echo "Package version is $PACKAGE_VERSION" - # mkdir -p cdn/${CDN_MODULE_NAME}/${CDN_VERSION} - # cp -r build/* cdn/${CDN_MODULE_NAME}/${CDN_VERSION} + + # mkdir -p cdn/${REPO_NAME}/${PACKAGE_VERSION} + # cp -r build/* cdn/${REPO_NAME}/${PACKAGE_VERSION} # cd cdn # git config user.name "github-actions" # git config user.email "github-actions@github.com" # git checkout -b "${CDN_REPO_BRANCH}" || git checkout "${CDN_REPO_BRANCH}" # git add . - # git commit -m "Add ${CDN_MODULE_NAME} ${CDN_VERSION}" + # git commit -m "Add ${REPO_NAME} ${PACKAGE_VERSION}" # git push origin "${CDN_REPO_BRANCH}" # ... pull-request here ... + # verify if this stuff bellow works + # echo "${{ secrets.ACCESS_TOKEN }}" > token.txt + # gh auth login --with-token < token.txt + # gh pr create \ + # --body "" \ + # --title "chore: update scripts to $LATEST_TAG" \ + # --head "$BRANCH_NAME" \ + # --base "main"