name: Build main artifact on: push: branches: - main jobs: package: runs-on: gitea-runner-server03 steps: - uses: actions/checkout@v7 - uses: actions/setup-node@v7 with: node-version: '24' - name: Install JS dependencies run: npm install - name: Build frontend run: npm run build - name: Package appstore artifact run: make appstore - name: Publish rolling "latest-main" release env: GITEA_API: ${{ gitea.server_url }}/api/v1 REPO: ${{ gitea.repository }} TOKEN: ${{ secrets.RELEASE_TOKEN }} SHA: ${{ gitea.sha }} run: | set -e TAG="latest-main" ASSET="build/artifacts/appstore/workflow_deck_automation.tar.gz" # Drop any previous release+tag so the download URL always serves the newest build curl -s -H "Authorization: token $TOKEN" \ "$GITEA_API/repos/$REPO/releases/tags/$TAG" -o /tmp/old_release.json OLD_ID=$(node -e "try{const j=require('/tmp/old_release.json');console.log(j.id||'')}catch(e){console.log('')}") if [ -n "$OLD_ID" ]; then curl -s -X DELETE -H "Authorization: token $TOKEN" \ "$GITEA_API/repos/$REPO/releases/$OLD_ID" fi curl -s -X DELETE -H "Authorization: token $TOKEN" \ "$GITEA_API/repos/$REPO/tags/$TAG" > /dev/null || true # Re-create the tag+release pointing at the commit that was just built curl -s -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"$SHA\",\"name\":\"Latest main build\",\"body\":\"Automatisch aus $SHA gebaut - nur zum schnellen Testen/Deployen, kein offizielles Release.\",\"prerelease\":true}" \ "$GITEA_API/repos/$REPO/releases" -o /tmp/new_release.json NEW_ID=$(node -e "console.log(require('/tmp/new_release.json').id)") curl -s -X POST -H "Authorization: token $TOKEN" \ -F "attachment=@$ASSET" \ "$GITEA_API/repos/$REPO/releases/$NEW_ID/assets?name=workflow_deck_automation.tar.gz"