diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d97a4b1b..1d2f6458 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4119ce6..4fe48276 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/README.md b/README.md index b53e168e..416d6f98 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/precompile-release.sh b/precompile-release.sh deleted file mode 100755 index 1c6d2869..00000000 --- a/precompile-release.sh +++ /dev/null @@ -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 \ No newline at end of file