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 name: Build release
on: on:
release: push:
types: [published, edited] branches:
- master
jobs: jobs:
build-release: setup-release:
runs-on: ubuntu-latest outputs:
steps: release_created: ${{ steps.release.outputs.release_created }}
- uses: actions/checkout@master upload_url: ${{ steps.release.outputs.upload_url }}
- name: Install & build runs-on: ubuntu-latest
uses: actions/setup-node@master steps:
- run: npm install - name: Checkout repository
- run: npm run build uses: actions/checkout@v2
- name: Zip it - name: Run release please
uses: montudor/action-zip@v0.1.0 uses: google-github-actions/release-please-action@v2.16
with: id: release
args: zip -qq -r ./release.zip ./vuetorrent with:
- name: Get Version token: ${{ secrets.GITHUB_TOKEN }}
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV release-type: node
- name: Upload package-name: VueTorrent
uses: actions/upload-release-asset@v1.0.1 upload-release:
env: needs: setup-release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} if: ${{ needs.setup-release.outputs.release_created }}
with: runs-on: ubuntu-latest
upload_url: ${{ github.event.release.upload_url }} steps:
asset_path: ./release.zip - name: Checkout repository
asset_name: release.zip uses: actions/checkout@v2
asset_content_type: application/zip - 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 name: Test Core Components
on: on:
push pull_request:
branches:
- master
push:
branches:
- master
jobs: jobs:
test-core: test-core:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@master - name: Checkout repository
- name: Cache node modules uses: actions/checkout@v2
uses: actions/cache@v2 - name: Setup Node.js
env: - uses: actions/setup-node@v2
cache-name: cache-node-modules with:
node-version: '14'
- name: Build Node.js cache
uses: actions/cache@v2
with: with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: ${{ runner.os }}-node-
${{ runner.os }}-build-${{ env.cache-name }}- - name: Install dependencies
${{ runner.os }}-build- run: npm ci
${{ runner.os }}- - name: Run tests
- name: Install & test run: npm run test:unit
uses: actions/setup-node@master
- run: npm ci
- run: npm run test:unit

View file

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