Skip to content

Commit

Permalink
Merge pull request #21 from klemola/package-exe
Browse files Browse the repository at this point in the history
Set up binaries for releases
  • Loading branch information
klemola committed Nov 22, 2019
2 parents 4029b3b + d92a5e5 commit 8a83d28
Show file tree
Hide file tree
Showing 6 changed files with 1,606 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
tags:
- "v*.*.**"

jobs:
package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Set env
run: |
echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
echo ::set-env name=ARCHIVE_NAME::$(echo "foobar2000-web-ui-${GITHUB_REF:10}.tar.gz")
- uses: actions/setup-node@v1
with:
node-version: "12.x"

- name: Build
run: |
yarn
yarn build
- name: Package
id: package
run: |
cd ./release
yarn
yarn package
tar -czf dist/${{ env.ARCHIVE_NAME }} dist/foobar2000-web-ui.exe
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./release/dist/${{ env.ARCHIVE_NAME }}"
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ npm-debug.log
.DS_Store
.vscode
build/
dist/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "foobar2000-web-ui",
"version": "0.1.0",
"author": "Matias Klemola <matias.klemola@gmail.com>",
"description": "Control foobar2000 from the web.",
"description": "Control foobar2000 from a browser.",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -11,6 +11,7 @@
"keywords": [
"foobar2000",
"remote control",
"ui",
"server"
],
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions release/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { exec } = require('pkg')

const SERVER_ENTRYPOINT = '../build/main.js'
const TARGET = 'node12-win-x64'
const PKG_OUTPUT = './dist/foobar2000-web-ui.exe'

exec([SERVER_ENTRYPOINT, '--target', TARGET, '--output', PKG_OUTPUT])
.then(() => console.info('✅ .exe built!'))
.catch(console.error)
11 changes: 11 additions & 0 deletions release/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "foobar2000-web-ui-release",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"package": "node index.js"
},
"dependencies": {
"pkg": "4.4.0"
}
}
Loading

0 comments on commit 8a83d28

Please sign in to comment.