forked from stephan83/download-github-release
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert from travis to GitHub actions #284
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4fe9084
update dependabot.yml
busma13 cae59c2
replace travis ci with github actions
busma13 f5ce3c1
fix linting error
busma13 5cda481
Remove TravisCI and codecov links from readme
busma13 f5fedfe
Add publish.sh and publish.yml files
busma13 0d05108
bump version
busma13 fea4bad
use yarn publish directly in action
busma13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,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 }} |
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,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] | ||
busma13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -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/[email protected]... | ||
|
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
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,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 "$@" |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets discuss whether we really need a separate publish.sh or should we do a more standard workflow like:
https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will work. I just need to pass in the new version or
yarn publish
will try to bump it.