feat: auto releasing ci (#146)

* feat: auto releasing ci

* chore: pin major version for upload-release-asset

* ci: remove duplicate install deps

* docs: update readme

* chore: remove deprecated release script

Co-authored-by: Daan Wijns <dw.daanwijns@gmail.com>
This commit is contained in:
Jef LeCompte 2021-02-07 13:18:14 -05:00 committed by GitHub
parent 6860f06715
commit d217627d9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 73 deletions

View file

@ -1,29 +1,80 @@
name: Build release
on:
release:
types: [published, edited]
push:
branches:
- master
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install & build
uses: actions/setup-node@master
- run: npm install
- run: npm run build
- name: Zip it
uses: montudor/action-zip@v0.1.0
with:
args: zip -qq -r ./release.zip ./vuetorrent
- name: Get Version
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- name: Upload
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./release.zip
asset_name: release.zip
asset_content_type: application/zip
setup-release:
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run release please
uses: google-github-actions/release-please-action@v2.16
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: VueTorrent
upload-release:
needs: setup-release
if: ${{ needs.setup-release.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build Node.js cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build VueTorrent
run: npm run build
- name: Zip VueTorrent
run: zip -qq -r ./vuetorrent.zip ./vuetorrent
- name: Upload VueTorrent release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup-release.outputs.upload_url }}
asset_path: ./vuetorrent.zip
asset_name: vuetorrent.zip
asset_content_type: application/zip
push-release:
needs: setup-release
if: ${{ needs.setup-release.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build Node.js cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build VueTorrent
run: npm run build
- name: Push to latest-release
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: latest-release
FOLDER: ./vuetorrent/public

View file

@ -1,25 +1,29 @@
name: Test Core Components
on:
push
pull_request:
branches:
- master
push:
branches:
- master
jobs:
test-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build Node.js cache
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install & test
uses: actions/setup-node@master
- run: npm ci
- run: npm run test:unit
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:unit

View file

@ -22,13 +22,13 @@ The sleekest looking WebUI for qBittorrent made with Vue.js!
### Manual
- Visit the [Releases](https://github.com/WDaan/VueTorrent/releases) page!
- Download the latest `release.zip`
- Download the latest `vuetorrent.zip`
- Unzip the downloaded file
- Point your alternate WebUI location to the `vuetorrent` folder in qBittorrent settings
### From Source
- Head to the [`latest_release`](https://github.com/WDaan/VueTorrent/tree/latest-release) branch
- Head to the [`latest-release`](https://github.com/WDaan/VueTorrent/tree/latest-release) branch
- Clone branch using
- `git clone --single-branch --branch latest-release https://github.com/WDaan/VueTorrent.git`
- Pull changes every once in a while, using `git pull`

View file

@ -1,29 +0,0 @@
#!/bin/bash
build_and_copy(){
npm run build --production
VERSION=$(jq -r .version package.json)
mkdir ../vuetorrent-release
git clone git@github.com:WDaan/VueTorrent.git ../vuetorrent-release
cd ../vuetorrent-release
git checkout latest-release
git pull
sudo rm -r public || true
cp -r ../vuetorrent/vuetorrent/* ./
}
cleanup(){
cd ..
sudo rm -r vuetorrent-release
}
commit_and_push(){
git add --all
git commit -m "Release v$VERSION"
git push --set-upstream origin latest-release
}
build_and_copy
commit_and_push
cleanup