Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1a3f286
chore(deps): used cargo features prune to reduce the deps count
ValDesign22 Mar 15, 2026
8020a4c
feat(deps): add missing features
ValDesign22 Mar 16, 2026
0dd1460
fix(ci): added docker buildx setup to docker_build workflow
Nonolanlan1007 Mar 18, 2026
c2485f7
fix(ci): fixed Docker path in docker_build workflow
Nonolanlan1007 Mar 18, 2026
3190540
fix(ci): docker image name in docker_build workflow
Nonolanlan1007 Mar 18, 2026
f2cbb91
fix(ci): updated permissions in docker_build workflow
Nonolanlan1007 Mar 18, 2026
cf4d79a
fix(routes): modify the payload to use only the graph name for custom
ValDesign22 Mar 18, 2026
a135d55
fix(ci): updated image tags in docker_build workflow
Nonolanlan1007 Mar 18, 2026
9b26b1c
feat(ci): added docker build cache & PR preview notification in docke…
Nonolanlan1007 Mar 18, 2026
8df46ff
fix(ci): removed pull_request trigger on workflow docker_build workflow
Nonolanlan1007 Mar 18, 2026
635ab1c
fix(deps): error during auth
ValDesign22 Mar 18, 2026
0a5f07d
feat(stats): deleting existing event delete all its entries from stats
ValDesign22 Mar 18, 2026
93c3bb5
feat(routes): add delete event from stats call to the actual route
ValDesign22 Mar 18, 2026
00310c2
fix(ci): cache now (i hope) works for cargo-chef
ValDesign22 Mar 18, 2026
82cc3b6
refactor(mails): shortened message for the bot token regen mail
ValDesign22 Mar 18, 2026
877eb73
fix(deps): auth now work without issues
ValDesign22 Mar 19, 2026
deddd81
feat(deps): add missing feature for tracing-actix-web
ValDesign22 Mar 19, 2026
72fde20
refactor(services): remove debug print
ValDesign22 Mar 19, 2026
b3948fe
refactor(models): remove editable field from Achievement
ValDesign22 Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 80 additions & 4 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
REGISTRY_GHCR: ghcr.io
GHCR_REPO: ghcr.io/${{ github.repository }}
GHCR_REPO: ghcr.io/discordanalytics/api

jobs:
build:
Expand Down Expand Up @@ -40,6 +40,9 @@ jobs:
- feature: none
args: "--no-default-features"
suffix: ""
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
Expand All @@ -58,16 +61,21 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push by Digest
id: build
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
file: Dockerfile
build-args: BUILD_ARGS=${{ matrix.args }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.GHCR_REPO }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ env.GHCR_REPO }}:cache-${{ matrix.feature }}-${{ matrix.arch }}
cache-to: type=registry,ref=${{ env.GHCR_REPO }}:cache-${{ matrix.feature }}-${{ matrix.arch }},mode=max

- name: Export digest
run: |
Expand Down Expand Up @@ -98,6 +106,11 @@ jobs:
suffix: "-reports"
- feature: none
suffix: ""
permissions:
contents: read
packages: write
pull-requests: write

steps:
- name: Download digests
uses: actions/download-artifact@v4
Expand All @@ -116,7 +129,13 @@ jobs:
- name: Create manifest and push
working-directory: /tmp/digests
run: |
TAGS="-t ${{ env.GHCR_REPO }}:latest${{ matrix.suffix }}"
NORMALIZED_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr '_' '-' | tr '[:upper:]' '[:lower:]')

TAGS="-t ${{ env.GHCR_REPO }}:${NORMALIZED_BRANCH}${{ matrix.suffix }}"

if [[ "$NORMALIZED_BRANCH" == "master" ]]; then
TAGS="$TAGS -t ${{ env.GHCR_REPO }}:latest${{ matrix.suffix }}"
fi

if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
Expand All @@ -128,4 +147,61 @@ jobs:
fi

docker buildx imagetools create $TAGS \
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)

notify:
runs-on: ubuntu-latest
needs: merge
if: github.event_name == 'workflow_dispatch'
permissions:
pull-requests: write

steps:
- name: Post or update preview comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
MARKER: "<!-- docker-preview-comment -->"
run: |
NORMALIZED_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr '_' '-' | tr '[:upper:]' '[:lower:]')
BRANCH_DISPLAY="${{ github.ref_name }}"

# Find the open PR for the current branch, if any
PR_NUMBER=$(gh api "repos/${REPO}/pulls" \
--jq ".[] | select(.head.ref == \"${{ github.ref_name }}\" and .state == \"open\") | .number" \
| head -n1)

if [[ -z "$PR_NUMBER" ]]; then
echo "No open PR found for branch ${{ github.ref_name }}, skipping comment."
exit 0
fi
BODY="${MARKER}
## 🐳 Docker preview images are ready!

Preview images are available for this PR:

| Variant | Tag |
|---------|-----|
| Default | \`${{ env.GHCR_REPO }}:${NORMALIZED_BRANCH}\` |
| Full | \`${{ env.GHCR_REPO }}:${NORMALIZED_BRANCH}-full\` |
| Mails | \`${{ env.GHCR_REPO }}:${NORMALIZED_BRANCH}-mails\` |
| Reports | \`${{ env.GHCR_REPO }}:${NORMALIZED_BRANCH}-reports\` |

> You can mention a maintainer to update it."

# Look for an existing comment with the marker
EXISTING_ID=$(gh api \
"repos/${REPO}/issues/${PR_NUMBER}/comments" \
--paginate \
--jq ".[] | select(.body | startswith(\"${MARKER}\")) | .id" \
| head -n1)

if [[ -n "$EXISTING_ID" ]]; then
gh api --method PATCH \
"repos/${REPO}/issues/comments/${EXISTING_ID}" \
-f body="$BODY"
else
gh api --method POST \
"repos/${REPO}/issues/${PR_NUMBER}/comments" \
-f body="$BODY"
fi
Loading