Skip to content

Commit

Permalink
v2.0.14: travis ci and github releases (#3)
Browse files Browse the repository at this point in the history
* fix: travis ci

* fix: travis ci node

* fix: release test

* fix: release test

* fix: release test

* fix: release test 2.0.4

* fix: release test 2.0.5

* fix: release test 2.0.6 with tag

* fix: release test 2.0.7

* fix: release test 2.0.8

* fix: release test 2.0.9

* fix: release test 2.0.10

* fix: release test 2.0.12

* fix: release test 2.0.13

* fix: release test 2.0.14
  • Loading branch information
Markkop authored Apr 24, 2020
1 parent 3715348 commit b8530f4
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 45 deletions.
50 changes: 24 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
os: linux
dist: xenial
language: node_js
node_js: "9.11.1"
node_js: '10.18.0'

jobs:
include:
- os: linux
dist: trusty
services: docker
language: generic

cache:
yarn: true
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/.npm/_prebuilds

env:
global:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

jobs:
include:
- stage: Test
script:
- npm test
- stage: Deploy Windows & Mac
if: tag IS present
os: osx
osx_image: xcode10.1
script:
- npm run release -- --mac --win
before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
- stage: Deploy linux
if: tag IS present
os: linux
dist: trusty
script:
- npm run release
script:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker run --rm \
-e GH_TOKEN=$GH_TOKEN \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:wine \
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn build"
else
echo 'other build method'
fi
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
# :vhs: Youtube - Download and Cut

![Repo status](https://www.repostatus.org/badges/latest/active.svg)
[![Build Status](https://travis-ci.com/Markkop/yt-dlandcut.svg?branch=master)](https://travis-ci.com/Markkop/yt-dlandcut)
![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)

## What it is

This tool downloads a Youtube video to `videos` folder and cuts it given a starting and an ending time.\
The time must be in the format `HH:MM:SS` and the duration can't be longer than 24 hours.
This app **downloads** youtube videos using [youtube-dl](https://youtube-dl.org/) and **cuts** them with [ffmpeg](https://www.ffmpeg.org/) given starting and ending times.
Currently it only supports **Windows** e **Linux**.

## How to use

- Install NodeJS and ffmpeg
- Clone or download this repository
- Run `npm start` inside the project's folder
- Provide required information
- Check `videos` folder
Download the [latest release](https://github.com/Markkop/yt-dlandcut/releases/latest) for Linux (**.appImage**) or Windows (**.exe**) at the [releases](https://github.com/Markkop/yt-dlandcut/releases/) page.

## User Options
## Options

![An example of user options](http://i.imgur.com/avvmjF8.png)
- **Youtube url\***: normal or shortened url
- **Starting and ending times\***: in HH:MM:SS format
- **Convert to mp3**: if the cut should also be converted to audio
- **Download again**: to not skip download if file exists
- **Open on finish**: opens cut video/audio
- **Custom file name**: instead of video's title

## How to develop

Clone this repository and run `yarn` to install dependencies.
Make sure to have `node` and `npm` installed.

## How to deploy/release

It looks like `electron-builder` already does a lot when [releasing](https://www.electron.build/configuration/publish) a new version of an Electron app to github.

The first option to build and release this project's binaries is by running the `package.json` script command `yarn release`.
Electron Builder will know that it should also deploy after building because of this script command name `release` and it will look for a `GH_TOKEN` environment variable to publish to GitHub as a draft release with the package version.
You can set this environment variable by adding `export GH_TOKEN=CHANGE_THIS` to `~/.zshrc` or `~/.bashrc` file and sourcing it with `source ~./zshrc` after [creating a token](https://github.com/settings/tokens/new).

However, the [recommend way](https://www.electron.build/configuration/publish#recommended-github-releases-workflow) is by using a Continuous Integration service, [TravisCI](https://travis-ci.com/) in this case.
First, a collaborator have to [draft a new release](https://help.github.com/articles/creating-releases/) with the `package.json` version. Then, after every push, TravisCI will run `yarn build`, building the files and providing them as assets in the drafted Github's release.

For this to happen, it's required to have `"build": { "publish": "github" }` in `package.json` and `GH_TOKEN` as environment variable inside TravisCI dashboard's build settings.
Then after a passing build, a collaborator can simply publish it.
The current `.travis.yml` is similar to this [sample](https://www.electron.build/multi-platform-build#sample-travisyml-to-build-electron-app-for-macos-linux-and-windows).

It's also possible to deploy using [provider: releases](https://docs.travis-ci.com/user/deployment/releases/) TravisCI deploy configuration.
Here are some examples: [this](https://github.com/lane-c-wagner/electron-ci-boilerplate/blob/master/.travis.yml) and [this](https://github.com/gontarczyk-artur/electron-travis-poc/blob/master/.travis.yml).
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"name": "yt-dlandcut",
"version": "2.0.0",
"version": "2.0.14",
"description": "Download and Cut an Youtube video by its starting and ending times",
"repository": "github:markkop/yt-dlandcut",
"main": "build/electron/main.js",
"scripts": {
"start": "electron .",
"postinstall": "electron-builder install-app-deps",
"start": "electron .",
"transpile": "babel src --out-dir build",
"pack": "electron-builder --dir",
"dist:linux": "electron-builder build --linux AppImage ",
"dist:win": "electron-builder build --win portable ",
"dist": "electron-builder build --win portable --linux AppImage ",
"build": "babel src --out-dir build",
"release": "build"
"build": "yarn transpile && electron-builder",
"release": "yarn transpile && electron-builder --win --linux"
},
"keywords": [],
"author": "Marcelo 'Mark' Kopmann",
Expand Down Expand Up @@ -42,8 +40,12 @@
"node_modules/youtube-dl/bin/youtube-dl",
"package.json"
],
"publish": [
"github"
]
"linux": {
"target": "appImage"
},
"win": {
"target": "portable"
},
"publish": "github"
}
}

0 comments on commit b8530f4

Please sign in to comment.