Skip to content

Commit

Permalink
feat: Use native GitHub Action tools to download assets and use GitHu…
Browse files Browse the repository at this point in the history
…b API (#187)

* Use native GitHub Action tools to download assets and use GitHub API
* Fix unexpected output when tag not found
* Use GitHub Action exec
* Add screenshot

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
2 people authored and GitHub committed May 7, 2020
1 parent 88f1da8 commit 6c7b10c
Show file tree
Hide file tree
Showing 16 changed files with 3,576 additions and 26,477 deletions.
Binary file added .github/goreleaser-action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Install
run: npm install
-
name: Build
run: npm run build
-
name: Test
run: npm run test
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 CrazyMax
Copyright (c) 2019-2020 CrazyMax

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

---

![GoRelease Action](.github/goreleaser-action.png)

## Usage

```yaml
Expand Down
17 changes: 17 additions & 0 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as git from '../src/git';

describe('git', () => {
it('returns git tag', async () => {
const tag: string = await git.getTag();
console.log(tag);
expect(tag).not.toEqual('');
});
it('checks if tag is dirty', async () => {
expect(await git.isTagDirty('v1.3.1')).toBe(true);
});
it('returns short commit', async () => {
const commit: string = await git.getShortCommit();
console.log(commit);
expect(commit).not.toEqual('');
});
});
16 changes: 16 additions & 0 deletions __tests__/github.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as github from '../src/github';

describe('github', () => {
it('returns latest GoReleaser GitHub release', async () => {
const release = await github.getRelease('latest');
console.log(release);
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns v0.117.0 GoReleaser GitHub release', async () => {
const release = await github.getRelease('v0.117.0');
console.log(release);
expect(release).not.toBeNull();
expect(release?.tag_name).toEqual('v0.117.0');
});
});
2 changes: 2 additions & 0 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import * as installer from '../src/installer';
describe('installer', () => {
it('acquires v0.117.0 version of GoReleaser', async () => {
const goreleaser = await installer.getGoReleaser('v0.117.0');
console.log(goreleaser);
expect(fs.existsSync(goreleaser)).toBe(true);
}, 100000);

it('acquires latest version of GoReleaser', async () => {
const goreleaser = await installer.getGoReleaser('latest');
console.log(goreleaser);
expect(fs.existsSync(goreleaser)).toBe(true);
}, 100000);
});
Loading

0 comments on commit 6c7b10c

Please sign in to comment.