Skip to content

Commit

Permalink
Improve GH Actions, automate release, rm Travis
Browse files Browse the repository at this point in the history
Switch from Travis to GitHub Actions, removing two dev dependencies.
Release workflow for automated release.
  • Loading branch information
daquinoaldo committed Aug 1, 2020
1 parent b85bf6a commit f6c523e
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 996 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "CodeQL"
name: CodeQL

on:
push:
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/publish.yml

This file was deleted.

90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release

on:
workflow_dispatch:
inputs:
upgrade:
description: Type of version upgrade (patch, minor, major)
required: true
default: patch

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: 12
registry-url: https://registry.npmjs.org/

- name: Setup git
run: |-
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: npm version ${{ github.event.inputs.upgrade }}

- run: git push
- run: git push --tags

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Prepare build
run: npm i -g pkg

- name: Build
run: pkg --out-path build .

- name: Get version and package name
id: get_info
run: |-
version=$(node -p "require('./package.json').version")
echo $version
echo "::set-output name=version::$version"
name=$(node -p "require('./package.json').name")
echo $name
echo "::set-output name=name::$name"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_info.outputs.version }}
release_name: Release v${{ steps.get_info.outputs.version }}
draft: false
prerelease: false

- name: Upload Linux Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/${{ steps.get_info.outputs.name }}-linux
asset_name: ${{ steps.get_info.outputs.name }}-linux
asset_content_type: application/x-executable

- name: Upload MacOS Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/${{ steps.get_info.outputs.name }}-macos
asset_name: ${{ steps.get_info.outputs.name }}-macos
asset_content_type: application/x-mach-binary

- name: Upload Windows Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/${{ steps.get_info.outputs.name }}-win.exe
asset_name: ${{ steps.get_info.outputs.name }}-win.exe
asset_content_type: application/x-dosexec
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub CI
name: Test

on: [push, pull_request]

Expand All @@ -16,7 +16,7 @@ jobs:
node: 8

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Use Node.js ${{matrix.node}}
uses: actions/setup-node@v1
with:
Expand All @@ -33,7 +33,7 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
Expand Down
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ It works with MacOS, Linux and Windows, on Chrome and Firefox, and requires you

[![NPM](https://nodei.co/npm/https-localhost.png)](https://nodei.co/npm/https-localhost/)

[![Build Status](https://travis-ci.com/daquinoaldo/https-localhost.svg?branch=master)](https://travis-ci.com/daquinoaldo/https-localhost)
[![Test](https://github.com/daquinoaldo/https-localhost/workflows/Test/badge.svg)](https://github.com/daquinoaldo/https-localhost/actions?query=workflow:Test)
[![Coverage Status](https://coveralls.io/repos/github/daquinoaldo/https-localhost/badge.svg?branch=master)](https://coveralls.io/github/daquinoaldo/https-localhost?branch=master)
[![Dependency Status](https://img.shields.io/david/daquinoaldo/https-localhost.svg)](https://david-dm.org/daquinoaldo/https-localhost)
[![Known Vulnerabilities](https://snyk.io/test/npm/https-localhost/badge.svg)](https://snyk.io/test/npm/https-localhost)
[![GitHub issues](https://img.shields.io/github/issues/daquinoaldo/https-localhost.svg)](https://github.com/daquinoaldo/https-localhost/issues)
[![GitHub Actions](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fdaquinoaldo%2Fhttps-localhost%2Fbadge)](https://actions-badge.atrox.dev/daquinoaldo/https-localhost/goto)


## Dependencies
Expand Down

0 comments on commit f6c523e

Please sign in to comment.