name: release on: push: env: TAG: latest IMAGE_NAME: ${{ gitea.repository }} APP_TOKEN: ${{ secrets.APP_TOKEN }} REGISTRY: localhost:8088 GITEA_URL: https://git.syui.ai jobs: release: name: Release runs-on: ubuntu-latest container: image: ghcr.io/syui/aios options: --privileged steps: - name: Pull and push to local registry run: | pacman -Sy --noconfirm docker docker pull ghcr.io/syui/aios docker tag ghcr.io/syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} - name: Create release run: | existing=$(curl -s -H "Authorization: token ${{ env.APP_TOKEN }}" "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/tags/${{ env.TAG }}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) if [ -n "$existing" ]; then curl -s -X DELETE -H "Authorization: token ${{ env.APP_TOKEN }}" "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/$existing" fi git tag -f ${{ env.TAG }} 2>/dev/null || true curl -s -X POST -H "Authorization: token ${{ env.APP_TOKEN }}" -H "Content-Type: application/json" \ -d '{"tag_name":"${{ env.TAG }}","name":"${{ env.TAG }}","body":"build '$(date +%Y.%m.%d)'\n\ndownload: https://github.com/syui/aios/releases/download/latest/aios.tar.gz"}' \ "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases"