name: Release on: push: branches: [master] paths-ignore: - '**.md' - '.forgejo/**' workflow_dispatch: jobs: release: runs-on: docker container: image: node:20-bookworm steps: - name: Checkout (full history for tags) uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - name: Determine next version id: version run: node .forgejo/version.js - name: Install dependencies run: npm ci - name: Set version in package.json run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version - name: Build Linux AppImage run: npm run build:linux env: # Подавляем попытку electron-builder публиковать на GitHub GH_TOKEN: "" - name: Find built AppImage id: artifact run: | APPIMAGE=$(ls dist/*.AppImage | head -1) echo "path=$APPIMAGE" >> $GITHUB_OUTPUT echo "name=$(basename $APPIMAGE)" >> $GITHUB_OUTPUT - name: Create and push tag env: TAG: ${{ steps.version.outputs.tag }} GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config user.email "ci@vodyanoysh.ru" git config user.name "Forgejo CI" git remote set-url origin "https://x-token:${GIT_TOKEN}@git.vodyanoysh.ru/vodyanoy/aero-mail.git" git tag "$TAG" git push origin "$TAG" - name: Create Forgejo release id: release env: TAG: ${{ steps.version.outputs.tag }} TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | RELEASE=$(curl -sf -X POST \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"Aero Mail ${TAG}\",\"body\":\"Автоматический релиз.\",\"draft\":false,\"prerelease\":false}" \ "https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases") echo "id=$(echo "$RELEASE" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')" >> $GITHUB_OUTPUT - name: Upload AppImage to release env: TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_ID: ${{ steps.release.outputs.id }} ASSET_PATH: ${{ steps.artifact.outputs.path }} ASSET_NAME: ${{ steps.artifact.outputs.name }} run: | curl -sf -X POST \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary @"${ASSET_PATH}" \ "https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases/${RELEASE_ID}/assets?name=${ASSET_NAME}"