From 4fe90844816b22bab4238f2a973dbadd39455553 Mon Sep 17 00:00:00 2001 From: busma13 Date: Wed, 8 May 2024 14:13:40 -0700 Subject: [PATCH 1/7] update dependabot.yml --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 31c4615..820b237 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,6 +10,8 @@ updates: assignees: - jsnoble - godber + - busma13 + - sotojn ignore: - dependency-name: '@types/node' versions: From cae59c2fb67bea4cc3d8da1af63403b4edbc12e5 Mon Sep 17 00:00:00 2001 From: busma13 Date: Wed, 8 May 2024 14:13:57 -0700 Subject: [PATCH 2/7] replace travis ci with github actions --- .github/workflows/test.yml | 48 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 29 ----------------------- 2 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0c0b452 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +name: Fetch-Github-Release Tests +on: + pull_request: + branches: [ master ] + +jobs: + verify-build: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18.19.1 + cache: 'yarn' + + - name: Install and build packages + run: yarn setup + env: + YARN_SETUP_ARGS: "--prod=false --silent" + + - name: Lint codebase + run: yarn lint + + run-tests: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.19.1, 20.11.1, 22.1.0] + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install and build packages + run: yarn setup + env: + YARN_SETUP_ARGS: "--prod=false --silent" + + - name: Test + run: yarn --silent test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b544378..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -# set the dist to bionic -dist: bionic -language: node_js -node_js: - - '12' - - '14' -branches: - only: - - master - - "/^v\\d+\\.\\d+\\.\\d+/" -install: - - yarn -before_script: - - yarn build -script: - - stty cols 80 - - yarn test -after_script: - - yarn lint -after_success: - - bash <(curl -s https://codecov.io/bash) -deploy: - provider: npm - email: ci@terascope.io - api_token: $NPM_TOKEN - skip_cleanup: true - on: - tags: true - repo: terascope/fetch-github-release From f5ce3c145939937aa91365c48fb16504ddb8d8df Mon Sep 17 00:00:00 2001 From: busma13 Date: Wed, 8 May 2024 14:31:09 -0700 Subject: [PATCH 3/7] fix linting error --- src/cli.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index a895572..5eaa48a 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -58,11 +58,17 @@ function filterAsset(asset: GithubReleaseAsset): boolean { return new RegExp(command.search).test(asset.name); } -downloadRelease(user as string, repo as string, outputdir as string, filterRelease, filterAsset, - !!command.zipped, !!command.quiet) - .catch((err) => { - console.error(err); - process.exitCode = 1; - }).finally(() => { - process.exit(); - }); +downloadRelease( + user as string, + repo as string, + outputdir as string, + filterRelease, + filterAsset, + !!command.zipped, + !!command.quiet +).catch((err) => { + console.error(err); + process.exitCode = 1; +}).finally(() => { + process.exit(); +}); From 5cda4813bbea2e56db4cd3eeb51d0ff80bd9c4a8 Mon Sep 17 00:00:00 2001 From: busma13 Date: Wed, 8 May 2024 16:01:31 -0700 Subject: [PATCH 4/7] Remove TravisCI and codecov links from readme --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 8e2fe7f..1243d79 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,6 @@ A node module to download Github release assets. It will also uncompress zip files and skip downloading if a file already exists. -[![Build Status](https://travis-ci.org/terascope/fetch-github-release.svg?branch=master)](https://travis-ci.org/terascope/fetch-github-release) -[![codecov](https://codecov.io/gh/terascope/fetch-github-release/branch/master/graph/badge.svg)](https://codecov.io/gh/terascope/fetch-github-release) -[![Build Status](https://david-dm.org/terascope/fetch-github-release.svg)](https://david-dm.org/terascope/fetch-github-release) - ``` $ fetch-github-release -s darwin-x64 electron electron Downloading electron/electron@v1.3.1... From f5fedfe730bdf2843395e6f5b6afe2b979c8f451 Mon Sep 17 00:00:00 2001 From: busma13 Date: Wed, 8 May 2024 16:11:56 -0700 Subject: [PATCH 5/7] Add publish.sh and publish.yml files --- .github/workflows/publish.yml | 26 +++++++++++++++ scripts/publish.sh | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 scripts/publish.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c426483 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Build and Publish + +on: + pull_request: + branches: + - master + types: + - closed + +jobs: + npm-publish: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + # NOTE: Hard Coded Node Version + node-version: '18.19.1' + registry-url: 'https://registry.npmjs.org' + - run: yarn setup + - run: ./scripts/publish.sh + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 0000000..a79dbb6 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -e + +check_deps() { + if [ -z "$(command -v jq)" ]; then + echo "./publish.sh requires jq installed" + exit 1 + fi +} + +publish() { + local dryRun="$1" + local name tag targetVersion currentVersion isPrivate + + name="$(jq -r '.name' package.json)" + isPrivate="$(jq -r '.private' package.json)" + if [ "$isPrivate" == 'true' ]; then + echo "* $name is a private module skipping..." + return; + fi + + targetVersion="$(jq -r '.version' package.json)" + currentVersion="$(npm info --json 2> /dev/null | jq -r 'first(.[]) | .version // "0.0.0"')" + + if [ "$currentVersion" != "$targetVersion" ]; then + echo "Publishing:" + echo " $name@$currentVersion -> $targetVersion" + if [ "$dryRun" == "false" ]; then + yarn publish \ + --silent \ + --tag "$tag" \ + --non-interactive \ + --new-version "$targetVersion" \ + --no-git-tag-version + fi + else + echo "Not publishing:" + echo " $name@$currentVersion = $targetVersion" + fi +} + +main() { + check_deps + local projectDir dryRun='false' + + if [ "$1" == '--dry-run' ]; then + dryRun='true' + fi + + projectDir="$(pwd)" + + echo "Check NPM Authentication" + npm whoami + + publish "$dryRun"; +} + +main "$@" From 0d05108ecae79af682152fb12916313798dae513 Mon Sep 17 00:00:00 2001 From: busma13 Date: Wed, 8 May 2024 16:12:09 -0700 Subject: [PATCH 6/7] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a005bb9..cf263eb 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "0.8.7", + "version": "0.8.8", "description": "Download a specific release from github", "files": [ "dist/src/**/*", From fea4bade2698d342af98480ce51c2a44fb444892 Mon Sep 17 00:00:00 2001 From: busma13 Date: Thu, 9 May 2024 07:51:17 -0700 Subject: [PATCH 7/7] use yarn publish directly in action --- .github/workflows/publish.yml | 7 +++-- .github/workflows/test.yml | 4 +-- scripts/publish.sh | 59 ----------------------------------- 3 files changed, 7 insertions(+), 63 deletions(-) delete mode 100644 scripts/publish.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c426483..1dc1bcc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,9 +18,12 @@ jobs: - uses: actions/setup-node@v4 with: # NOTE: Hard Coded Node Version - node-version: '18.19.1' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: yarn setup - - run: ./scripts/publish.sh + - name: Retrieve version + run : echo "NEW_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT + id: version + - run: yarn publish --new-version ${{ steps.version.outputs.NEW_VERSION }} --access public --non-interactive env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c0b452..8ea83a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18.19.1 + node-version: 18.x cache: 'yarn' - name: Install and build packages @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18.19.1, 20.11.1, 22.1.0] + node-version: [18.x, 20.x, 22.x] steps: - name: Check out code uses: actions/checkout@v4 diff --git a/scripts/publish.sh b/scripts/publish.sh deleted file mode 100644 index a79dbb6..0000000 --- a/scripts/publish.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -set -e - -check_deps() { - if [ -z "$(command -v jq)" ]; then - echo "./publish.sh requires jq installed" - exit 1 - fi -} - -publish() { - local dryRun="$1" - local name tag targetVersion currentVersion isPrivate - - name="$(jq -r '.name' package.json)" - isPrivate="$(jq -r '.private' package.json)" - if [ "$isPrivate" == 'true' ]; then - echo "* $name is a private module skipping..." - return; - fi - - targetVersion="$(jq -r '.version' package.json)" - currentVersion="$(npm info --json 2> /dev/null | jq -r 'first(.[]) | .version // "0.0.0"')" - - if [ "$currentVersion" != "$targetVersion" ]; then - echo "Publishing:" - echo " $name@$currentVersion -> $targetVersion" - if [ "$dryRun" == "false" ]; then - yarn publish \ - --silent \ - --tag "$tag" \ - --non-interactive \ - --new-version "$targetVersion" \ - --no-git-tag-version - fi - else - echo "Not publishing:" - echo " $name@$currentVersion = $targetVersion" - fi -} - -main() { - check_deps - local projectDir dryRun='false' - - if [ "$1" == '--dry-run' ]; then - dryRun='true' - fi - - projectDir="$(pwd)" - - echo "Check NPM Authentication" - npm whoami - - publish "$dryRun"; -} - -main "$@"