This commit is contained in:
parent 1e8243ab9a
commit 1304960fa3

View file

@ -1,11 +1,14 @@
name: Gonets Release Debian Packaging name: Gonets Release Debian Packaging
on: on:
push:
branches:
- develop
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build-and-release: build-and-release:
runs-on: debian runs-on: debian-latest
steps: steps:
- name: Checkout main - name: Checkout main
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -13,46 +16,70 @@ jobs:
fetch-depth: 0 fetch-depth: 0
ref: main ref: main
- name: Установка всех необходимых зависимостей для сборки - name: Install dependencies
run: | run: |
sudo apt update sudo apt update
sudo apt install -y python3 python3-pip python3-poetry nodejs npm debhelper devscripts build-essential fakeroot dh-make sudo apt install -y python3 python3-pip python3-poetry nodejs npm debhelper devscripts build-essential fakeroot dh-make dpkg-dev
- name: Сборка backend - name: Prepare python dependencies
run: |
cd SRV
rm requirements.txt
poetry export -f requirements.txt --output requirements.txt --without-hashes
- name: Build backend
run: | run: |
cd SRV cd SRV
poetry install poetry install
- name: Сборка frontend - name: Build frontend
run: | run: |
cd FRONT/BUILD/resources/app cd FRONT/DEV
npm install npm install
npm run package
cd FRONT/DEV/dist/gonets-linux-x64/resources/app
npm run build npm run build
sed -i 's/href="\/assets\//href=".\/assets\//g' FRONT/DEV/dist/gonets-linux-x64/resources/app/dist/index.html
sed -i 's/src="\/assets\//src=".\/assets\//g' FRONT/DEV/dist/gonets-linux-x64/resources/app/dist/index.html
rm -rf FRONT/BUILD/*
cp -r FRONT/DEV/dist/gonets-linux-x64/* FRONT/BUILD/
rm -rf FRONT/DEV
- name: Build deb package - name: Preparing build debian package
run: |
DEBEMAIL="devteam@gossys.dev" DEBFULLNAME="GOSSYS LLC" dh_make --createorig
cd debian/
rm *.ex
rm README.*
- name: Clone debian configuration
run: |
git clone https://s.galanskiy:${{e5eaa40af9805f83a05ef70a0c946c03e1688633.GONETS}}@dev.gossys.dev/s.galanskiy/gonets-debian-template.git
mv gonets-debian-template/changelog gonets/debian/
mv gonets-debian-template/control gonets/debian/
mv gonets-debian-template/copyright gonets/debian/
mv gonets-debian-template/install gonets/debian/
mv gonets-debian-template/postinst gonets/debian/
mv gonets-debian-template/postrm gonets/debian/
mv gonets-debian-template/rules gonets/debian/
- name: Build package
run: | run: |
dpkg-buildpackage -us -uc -b dpkg-buildpackage -us -uc -b
- name: Get version from changelog - name: Get version from changelog
id: get_version
run: | run: |
VERSION=$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') dpkg-parsechangelog -l./debian/changelog --show-field VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create git tag - name: Commit changes to develop
env:
GIT_PUSH_TOKEN: ${{ secrets.GIT_PUSH_TOKEN }}
run: | run: |
git config --global user.email "ci-bot@example.com" git config user.name "s.galanskiy"
git config --global user.name "CI Bot" git config user.email "s.galanskiy@gossys.dev"
git tag gonets-${{ steps.get_version.outputs.version }} git checkout develop
git push https://ci-bot:${GIT_PUSH_TOKEN}@${GITEA_SERVER}/${GITEA_REPO}.git gonets-${{ steps.get_version.outputs.version }} git commit -m "Релиз $VERSION"
git tag "v$VERSION"
- name: Create release and upload deb git push origin develop
uses: softprops/action-gh-release@v2 git push origin "v$VERSION"
with:
tag_name: gonets-${{ steps.get_version.outputs.version }}
name: "Gonets ${{ steps.get_version.outputs.version }}"
files: ../*.deb
env: env:
GITHUB_TOKEN: ${{ secrets.GIT_PUSH_TOKEN }} VERSION: ${{ env.VERSION }}