Skip to content

Commit

Permalink
new: add release package
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Feb 28, 2023
1 parent 3170f0f commit 6290872
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 105 deletions.
15 changes: 15 additions & 0 deletions .gitchangelog.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
output_engine = mustache("markdown")

tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?$'

ignore_regexps = [
r'@minor', r'!minor',
r'@cosmetic', r'!cosmetic',
r'@refactor', r'!refactor',
r'@wip', r'!wip',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
r'^$', ## ignore commits with empty messages
r'release: version.*',
]
4 changes: 4 additions & 0 deletions .github/release_message.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
previous_release=$(curl --silent "https://api.github.com/repos/hiddify/hiddify-central-config/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
current=$(cat VERSION)
gitchangelog "${previous_release}..v$current"
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
test:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install project
run: |
sudo mkdir /opt/hiddify-central-config
sudo cp -r * /opt/hiddify-central-config/
cd /opt/hiddify-central-config/
sudo bash install.sh
- name: check working
env:
SQLALCHEMY_DATABASE_URI: sqlite:////opt/hiddify-central-config/hiddify-panel/database.db
run: |
cd /opt/hiddify-central-config/
grep -q -e '-----Finished!-----' log/system/0-install.log
cd hiddify-panel;hiddifypanel all-configs
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Create Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
test:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install project
run: |
sudo mkdir /opt/hiddify-central-config
sudo cp -r * /opt/hiddify-central-config/
cd /opt/hiddify-central-config/
sudo bash install.sh
- name: check working
env:
SQLALCHEMY_DATABASE_URI: sqlite:////opt/hiddify-central-config/hiddify-panel/database.db
run: |
cd /opt/hiddify-central-config/
grep -q -e '-----Finished!-----' log/system/0-install.log
cd hiddify-panel;hiddifypanel all-configs
release:
# if: startsWith(github.ref, 'refs/tags/v')
name: Create Release
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
with:
# by default, it uses a depth of 1
# this fetches all history so that we can read each commit
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install gitchangelog pystache
- name: Generate Changelog
run: .github/release_message.sh > release_message.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: release_message.md
2 changes: 0 additions & 2 deletions a.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
12 changes: 9 additions & 3 deletions hiddify-panel/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
systemctl kill hiddify-admin.service
systemctl disable hiddify-admin.service

for req in pip3 gunicorn;do
for req in pip3 gunicorn python3 hiddifypanel lastversion jq;do
which $req
if [[ "$?" != 0 ]];then
apt update
apt install -y python3-pip gunicorn
apt install -y python3-pip gunicorn jq
pip3 install pip
pip3 install -U hiddifypanel lastversion
break
fi
done

pip3 --disable-pip-version-check install -q -U hiddifypanel


ln -sf $(which gunicorn) /usr/bin/gunicorn

#pip3 --disable-pip-version-check install -q -U hiddifypanel
# pip uninstall -y hiddifypanel
# pip --disable-pip-version-check install -q -U git+https://github.com/hiddify/HiddifyPanel

Expand Down
20 changes: 20 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

which gitchangelog
if [[ "$?" != 0 ]];then
pip3 install gitchangelog pystache
fi
previous_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "previous version was $previous_tag"
read -p "Version? (provide the next x.y.z semver) : " TAG
[[ $TAG = v* ]] && echo "incorrect tag" && exit 1
echo "${TAG}" > VERSION
git tag v${TAG}
gitchangelog > HISTORY.md
git tag -d v${TAG}
git add VERSION HISTORY.md
git commit -m "release: version ${TAG} 🚀"
echo "creating git tag : v${TAG}"
git tag v${TAG}
git push -u origin HEAD --tags
echo "Github Actions will detect the new tag and release the new version."
86 changes: 0 additions & 86 deletions test.sh

This file was deleted.

27 changes: 14 additions & 13 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash
function main(){

for s in netdata other/**/*.service **/*.service nginx;do
s=${s##*/}
s=${s%%.*}
# printf "%-30s %-30s \n" $s $(systemctl is-active $s)
for s in netdata other/**/*.service **/*.service nginx;do
s=${s##*/}
s=${s%%.*}
systemctl kill $s
systemctl disable $s

done


rm -rf /etc/cron.d/hiddify*
service cron reload
systemctl disable $s
done
rm -rf /etc/cron.d/hiddify*
service cron reload
if [[ "$1" == "purge" ]];then
cd .. && rm -rf hiddify-central-panel
apt remove -y nginx gunicorn python3-pip python3
echo "We have completely removed hiddify central panel"
fi
}

mkdir -p log/system/
main |& tee log/system/uninstall.log
main $@|& tee log/system/uninstall.log
Binary file removed wiki_images/Coud Init Code.jpg
Binary file not shown.
1 change: 0 additions & 1 deletion wiki_images/README.md

This file was deleted.

0 comments on commit 6290872

Please sign in to comment.