Skip to content

Commit

Permalink
feat: create release
Browse files Browse the repository at this point in the history
  • Loading branch information
werwolfby committed Apr 2, 2023
1 parent 5d0cab9 commit 1d3c3ac
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 33 deletions.
159 changes: 126 additions & 33 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,132 @@ on:
type: string

jobs:

- name: Merge release branch into master
createRelease:
name: Merge release branch into master
runs-on: ubuntu-latest
steps:

- name: extract version from branch name by removing release/ prefix
id: extract-version
run: |
echo "version=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_OUTPUT
- name: Fail if version is empty
if: ${{ steps.extract-version.outputs.version == '' }}
run: exit 1

- name: Checkout master
uses: actions/checkout@v3
with:
ref: master

- name: merge current branch into master
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git merge --no-edit --no-ff -m "merge(${{ github.event.inputs.branch }}): ${{ github.events.inputs.release_description }}" ${{ github.event.inputs.branch }}
git push origin master
- name: Create tag
run: |
git tag ${{ steps.extract-version.outputs.version }}
git push origin ${{ steps.extract-version.outputs.version }}
- name: Merge into develop
run: |
git checkout develop
git merge --no-edit --no-ff -m "merge(master): merge back
git push origin develop
- name: extract version from branch name by removing release/ prefix
id: extract-version
run: |
echo "version=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_OUTPUT
- name: Fail if version is empty
if: ${{ steps.extract-version.outputs.version == '' }}
run: exit 1

- name: Checkout master
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0

- name: merge current branch into master
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git merge --no-edit --no-ff -m "merge(release/${{ steps.extract-version.outputs.version }}): ${{ github.event.inputs.release_description }}" origin/release/${{ steps.extract-version.outputs.version }}
git push origin master
- name: Create tag
run: |
git tag ${{ steps.extract-version.outputs.version }}
git push origin ${{ steps.extract-version.outputs.version }}
- name: Download artifact from latest workflow run on branch
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs");
const path = require("path");
const workflowName = 'build';
const branchName = process.env.GITHUB_REF.split('/').slice(2).join('/');
const artifactNames = ['release', 'installer'];
const workflows = await github.rest.actions.listRepoWorkflows({
owner: context.repo.owner,
repo: context.repo.repo,
});
// Log all workflows as json
// console.log(JSON.stringify(workflows.data, null, 2));
const workflow = workflows.data.workflows.find(w => w.name === workflowName);
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1,
branch: branchName,
workflow_id: workflow.id,
status: 'success',
});
// Log all workflows as json
// console.log(JSON.stringify(runs.data, null, 2));
const runId = runs.data.workflow_runs[0].id;
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: runId,
});
// Log all workflows as json
// console.log(JSON.stringify(artifacts.data, null, 2));
const artifactIds = {};
for (const name of artifactNames) {
const artifact = artifacts.data.artifacts.find(a => a.name === name);
if (artifact) {
artifactIds[name] = artifact.id;
} else {
console.log(`Artifact ${name} not found in latest workflow run.`);
}
}

const targetDir = '.artifacts';
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });
}

for (const [name, id] of Object.entries(artifactIds)) {
const response = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: id,
archive_format: 'zip',
});
const filePath = path.join(targetDir, `${name}.zip`);
fs.writeFileSync(filePath, Buffer.from(response.data));
}

- name: Unzip .artifacts
run: |
unzip .artifacts/release.zip -d .artifacts
unzip .artifacts/installer.zip -d .artifacts
mv .artifacts/MonitorrentInstaller.exe .artifacts/MonitorrentInstaller-${{ steps.extract-version.outputs.version }}.exe
rm .artifacts/release.zip
rm .artifacts/installer.zip
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: .artifacts/*
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.extract-version.outputs.version }} - ${{ github.event.inputs.release_description }}
tag: ${{ steps.extract-version.outputs.version }}
makeLatest: true
bodyFile: RELEASE_NOTES.md
draft: false
prerelease: false

- name: Merge into develop
run: |
git checkout develop
git merge --no-edit --no-ff -m "merge(master): merge back" origin/master
git push origin develop
29 changes: 29 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Trackers:
- support www.lostfilm.tv tracking over parse topic page with topic quality support (new design support) and Cloudflare DDOS protection solving
- support www.rutor.org topic tracking
- support www.free-torrents.org topic tracking
- support www.rutracker.org topic tracking and Cloudflare DDOS protection solving
- support www.tapochek.net topic tracking
- support www.unionpeer.org topic tracking
- support [nnmclub.to](http://nnmclub.to) topic tracking
- support [tr.anidub.com](http://tr.anidub.com) topic tracking with topic quality support
- support [kinozal.tv](http://kinozal.tv) topic tracking
- support [hdclub.org](http://hdclub.org) topic tracking
- support [anilibria.tv](https://www.anilibria.tv) topic tracking

### Torrent clients
- support download torrent files to specified folder (downloader plugin)
- support **transmission** over transmission-rpc
- support **deluge** over deluge-rpc
- support **uTorrent** over uTorrent web api
- support **qbittorrent** over webui api

### Notification services:
- support notifications over [telegram.org](https://telegram.org/)
- support notifications over [pushover.net](https://pushover.net)
- support notifications over **email**
- support notifications over [pushbullet.com](https://www.pushbullet.com)
- support notifications over [pushall.ru](https://pushall.ru)

Fixes:
~~#383~~ 1.2.3 Windows - Not start

0 comments on commit 1d3c3ac

Please sign in to comment.