diff --git a/.github/ISSUE_TEMPLATE/confirmed-bug.md b/.gitea/ISSUE_TEMPLATE/confirmed-bug.md similarity index 100% rename from .github/ISSUE_TEMPLATE/confirmed-bug.md rename to .gitea/ISSUE_TEMPLATE/confirmed-bug.md diff --git a/.github/ISSUE_TEMPLATE/feature-or-change-request.md b/.gitea/ISSUE_TEMPLATE/feature-or-change-request.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature-or-change-request.md rename to .gitea/ISSUE_TEMPLATE/feature-or-change-request.md diff --git a/.github/ISSUE_TEMPLATE/general-question.md b/.gitea/ISSUE_TEMPLATE/general-question.md similarity index 100% rename from .github/ISSUE_TEMPLATE/general-question.md rename to .gitea/ISSUE_TEMPLATE/general-question.md diff --git a/.github/ISSUE_TEMPLATE/possible-bug--needs-investigation-.md b/.gitea/ISSUE_TEMPLATE/possible-bug--needs-investigation-.md similarity index 100% rename from .github/ISSUE_TEMPLATE/possible-bug--needs-investigation-.md rename to .gitea/ISSUE_TEMPLATE/possible-bug--needs-investigation-.md diff --git a/.github/workflows/build-sanity.yml b/.gitea/workflows/build-sanity.yml similarity index 60% rename from .github/workflows/build-sanity.yml rename to .gitea/workflows/build-sanity.yml index 079b30c..28a7af8 100644 --- a/.github/workflows/build-sanity.yml +++ b/.gitea/workflows/build-sanity.yml @@ -1,10 +1,10 @@ name: Build Sanity Check on: - pull_request: - types: - - opened - + pull_request: + types: + - opened + jobs: build: runs-on: ubuntu-latest @@ -18,5 +18,13 @@ jobs: with: go-version: "1.26.1" + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install yarn + run: npm install -g yarn + - name: Prepare Dependencies and Build run: make dist diff --git a/.github/workflows/nightly.yml b/.gitea/workflows/nightly.yml similarity index 59% rename from .github/workflows/nightly.yml rename to .gitea/workflows/nightly.yml index bb33228..d43f004 100644 --- a/.github/workflows/nightly.yml +++ b/.gitea/workflows/nightly.yml @@ -4,10 +4,6 @@ on: - cron: "0 2 * * *" workflow_dispatch: -permissions: - contents: write - packages: write - jobs: check: runs-on: ubuntu-latest @@ -15,16 +11,19 @@ jobs: skip: ${{ steps.check_changes.outputs.skip }} steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check for changes since last nightly release id: check_changes env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ github.server_url }}/api/v1 + REPO: ${{ github.repository }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LAST_NIGHTLY_SHA=$(gh release view nightly --json targetCommitish -q '.targetCommitish' 2>/dev/null || echo "") + LAST_NIGHTLY_SHA=$(curl -sf -H "Authorization: token $TOKEN" \ + "$API/repos/$REPO/releases/tags/nightly" | jq -r '.target_commitish // empty' || echo "") CURRENT_SHA=$(git rev-parse HEAD) echo "Last nightly SHA: $LAST_NIGHTLY_SHA" echo "Current SHA: $CURRENT_SHA" @@ -42,7 +41,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -64,10 +63,18 @@ jobs: username: ${{ secrets.GITEA_REGISTRY_USER }} password: ${{ secrets.GITEA_REGISTRY_TOKEN }} - - name: Delete existing nightly release + - name: Delete existing nightly release and tag env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release delete nightly --yes --cleanup-tag 2>/dev/null || true + API: ${{ github.server_url }}/api/v1 + REPO: ${{ github.repository }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + RELEASE_ID=$(curl -sf -H "Authorization: token $TOKEN" \ + "$API/repos/$REPO/releases/tags/nightly" | jq -r '.id // empty' || echo "") + if [ -n "$RELEASE_ID" ]; then + curl -sf -X DELETE -H "Authorization: token $TOKEN" "$API/repos/$REPO/releases/$RELEASE_ID" || true + curl -sf -X DELETE -H "Authorization: token $TOKEN" "$API/repos/$REPO/tags/nightly" || true + fi - name: Set nightly date id: tag @@ -86,7 +93,6 @@ jobs: version: latest args: release --snapshot --parallelism 1 --clean --config .goreleaser-nightly.yml env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} EAGLECAST_VERSION: nightly-${{ steps.tag.outputs.date }} - name: Push Docker images @@ -109,19 +115,36 @@ jobs: run: | docker buildx imagetools inspect source.offmarket.win/aleagle/eaglecast:nightly - - name: Create GitHub Release + - name: Create Gitea release and upload assets env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ github.server_url }}/api/v1 + REPO: ${{ github.repository }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release create nightly \ - --title "Nightly release" \ - --notes " - > **Warning**: This is an automated nightly build from the master branch. + BODY="> **Warning**: This is an automated nightly build from the master branch. > It may contain bugs and breaking changes. Use at your own risk. - > Available on the Gitea container registry as `source.offmarket.win/aleagle/eaglecast:nightly`. + > Available on the Gitea container registry as \`source.offmarket.win/aleagle/eaglecast:nightly\`. > For stable releases, please use a versioned release. - Built from commit: $(git rev-parse --short HEAD)" \ - --prerelease \ - --target $(git rev-parse HEAD) \ - dist/*.tar.gz + Built from commit: $(git rev-parse --short HEAD)" + + PAYLOAD=$(jq -n \ + --arg tag "nightly" \ + --arg target "$(git rev-parse HEAD)" \ + --arg name "Nightly release" \ + --arg body "$BODY" \ + '{tag_name: $tag, target_commitish: $target, name: $name, body: $body, prerelease: true}') + + RELEASE_ID=$(curl -sf -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD" \ + "$API/repos/$REPO/releases" | jq -r '.id') + + for f in dist/*.tar.gz; do + curl -sf -X POST \ + -H "Authorization: token $TOKEN" \ + -F "attachment=@$f" \ + "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$(basename "$f")" > /dev/null + echo "uploaded: $(basename "$f")" + done diff --git a/.github/workflows/release.yml b/.gitea/workflows/release.yml similarity index 78% rename from .github/workflows/release.yml rename to .gitea/workflows/release.yml index cf07d99..d59538c 100644 --- a/.github/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -5,20 +5,21 @@ on: tags: - "v*" # Will trigger only if tag is pushed matching pattern `v*` (Eg: `v0.1.0`) -permissions: write-all - jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set up Go uses: actions/setup-go@v5 with: @@ -35,14 +36,11 @@ jobs: run: | make dist - - name: Check Docker Version - run: | - docker version - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: version: latest args: release --parallelism 1 --clean env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # goreleaser publishes the release to Gitea (see gitea_urls in .goreleaser.yml). + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml deleted file mode 100644 index d893b69..0000000 --- a/.github/workflows/github-pages.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: publish-github-pages - -on: - push: - branches: - - master - paths: - - 'docs/**' - workflow_dispatch: - -permissions: - contents: write - -jobs: - deploy: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.x - - run: pip install mkdocs-material - - # Build the mkdocs documentation in the docs/publish/docs dir. This will be at (/docs) - # The -d (output) path is relative to the -f (source) path - - name: Build docs site - run: mkdocs build -f docs/docs/mkdocs.yml -d ../publish/docs - - - name: Generate Swagger UI - uses: Legion2/swagger-ui-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - spec-file: ./docs/swagger/collections.yaml - output: ./docs/publish/docs/swagger - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_branch: gh-pages - publish_dir: ./docs/publish - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/hodor-review.yml b/.github/workflows/hodor-review.yml deleted file mode 100644 index 56994ac..0000000 --- a/.github/workflows/hodor-review.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Hodor AI Code Review - -on: - pull_request_target: - types: [labeled, synchronize] - paths-ignore: - - 'i18n/**' - - '*.md' - - 'LICENSE' - - '.gitignore' - -permissions: - contents: read - pull-requests: write - -jobs: - review: - if: >- - (github.event.action == 'labeled' && github.event.label.name == 'hodor-review') || - (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'hodor-review')) - runs-on: ubuntu-latest - steps: - - name: Run Hodor review - run: | - docker run --rm \ - -e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \ - -e LLM_API_KEY=${{ secrets.LLM_API_KEY }} \ - ghcr.io/mr-karan/hodor:0.3.4 \ - "https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}" \ - --model "${{ vars.HODOR_MODEL || 'gpt-5.2' }}" \ - --post diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml deleted file mode 100644 index 4e50446..0000000 --- a/.github/workflows/issues.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: "close-stale-issues-and-prs" -on: - schedule: - - cron: "30 1 * * *" - workflow_dispatch: - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v9 - with: - days-before-stale: 150 - stale-issue-label: "stale" - stale-pr-label: "stale" - debug-only: false - exempt-all-assignees: true - operations-per-run: 1000 - stale-issue-message: "This issue has been marked 'stale' after 5 months of inactivity. If there is no further activity, it will be closed in 7 days." - stale-pr-message: "This PR has been marked 'stale' after 5 months of inactivity. If there is no further activity, it will be closed in 7 days." diff --git a/.goreleaser-nightly.yml b/.goreleaser-nightly.yml index 9da1d10..1b5f27f 100644 --- a/.goreleaser-nightly.yml +++ b/.goreleaser-nightly.yml @@ -48,6 +48,7 @@ archives: files: - README.md - LICENSE + - NOTICE dockers: - use: buildx diff --git a/.goreleaser.yml b/.goreleaser.yml index 88a51d5..093ad3d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,10 @@ project_name: eaglecast +# Publish releases to the Gitea instance (requires GITEA_TOKEN). +gitea_urls: + api: https://source.offmarket.win/api/v1 + download: https://source.offmarket.win + env: - GO111MODULE=on - CGO_ENABLED=0 @@ -40,6 +45,7 @@ archives: files: - README.md - LICENSE + - NOTICE dockers: - use: buildx