diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 26470a9..14838a4 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -1,11 +1,14 @@ name: Gonets Release Debian Packaging on: + push: + branches: + - develop workflow_dispatch: jobs: build-and-release: - runs-on: debian + runs-on: debian-latest steps: - name: Checkout main uses: actions/checkout@v4 @@ -13,46 +16,70 @@ jobs: fetch-depth: 0 ref: main - - name: Установка всех необходимых зависимостей для сборки + - name: Install dependencies run: | 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: | cd SRV poetry install - - name: Сборка frontend + - name: Build frontend run: | - cd FRONT/BUILD/resources/app + cd FRONT/DEV npm install + npm run package + cd FRONT/DEV/dist/gonets-linux-x64/resources/app 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: | dpkg-buildpackage -us -uc -b - name: Get version from changelog - id: get_version run: | - VERSION=$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') - echo "version=$VERSION" >> $GITHUB_OUTPUT + dpkg-parsechangelog -l./debian/changelog --show-field VERSION + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - - name: Create git tag - env: - GIT_PUSH_TOKEN: ${{ secrets.GIT_PUSH_TOKEN }} + - name: Commit changes to develop run: | - git config --global user.email "ci-bot@example.com" - git config --global user.name "CI Bot" - git tag gonets-${{ steps.get_version.outputs.version }} - git push https://ci-bot:${GIT_PUSH_TOKEN}@${GITEA_SERVER}/${GITEA_REPO}.git gonets-${{ steps.get_version.outputs.version }} - - - name: Create release and upload deb - uses: softprops/action-gh-release@v2 - with: - tag_name: gonets-${{ steps.get_version.outputs.version }} - name: "Gonets ${{ steps.get_version.outputs.version }}" - files: ../*.deb + git config user.name "s.galanskiy" + git config user.email "s.galanskiy@gossys.dev" + git checkout develop + git commit -m "Релиз $VERSION" + git tag "v$VERSION" + git push origin develop + git push origin "v$VERSION" env: - GITHUB_TOKEN: ${{ secrets.GIT_PUSH_TOKEN }} \ No newline at end of file + VERSION: ${{ env.VERSION }} \ No newline at end of file