Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
types: [completed]

permissions:
actions: write
contents: write
pull-requests: write

Expand All @@ -27,10 +28,11 @@ jobs:
head_repo="$(jq -r '.head.repo.full_name' <<<"$pr")"
login="$(jq -r '.user.login' <<<"$pr")"
association="$(jq -r '.author_association' <<<"$pr")"
base_ref="$(jq -r '.base.ref' <<<"$pr")"
draft="$(jq -r '.draft' <<<"$pr")"

if [[ "$head_repo" != "$REPOSITORY" || "$draft" == "true" ]]; then
echo "Skipping forked or draft pull request."
if [[ "$head_repo" != "$REPOSITORY" || "$base_ref" != "main" || "$draft" == "true" ]]; then
echo "Skipping forked, non-main, or draft pull request."
exit 0
fi

Expand All @@ -39,5 +41,7 @@ jobs:
exit 0
fi

gh pr merge "$PR_NUMBER" --repo "$REPOSITORY" --squash --delete-branch
gh pr merge "$PR_NUMBER" --repo "$REPOSITORY" --merge --delete-branch
merge_sha="$(gh pr view "$PR_NUMBER" --repo "$REPOSITORY" --json mergeCommit --jq '.mergeCommit.oid')"
gh workflow run cd.yml --repo "$REPOSITORY" --ref main -f ref="$merge_sha"

19 changes: 14 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,39 @@ on:
workflow_run:
workflows: [CI]
types: [completed]
workflow_dispatch:
inputs:
ref:
description: Commit SHA to package
required: true
type: string

permissions:
contents: read

jobs:
release-artifact:
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main' &&
github.event.workflow_run.event == 'push'
github.event.workflow_run.event == 'push')
runs-on: ubuntu-latest
env:
RELEASE_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.event.workflow_run.head_sha }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
ref: ${{ env.RELEASE_REF }}
- uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
context: .
outputs: type=oci,dest=${{ runner.temp }}/local-llm-router.tar
tags: local-llm-router:${{ github.event.workflow_run.head_sha }}
tags: local-llm-router:${{ env.RELEASE_REF }}
- uses: actions/upload-artifact@v7
with:
name: local-llm-router-${{ github.event.workflow_run.head_sha }}
name: local-llm-router-${{ env.RELEASE_REF }}
path: ${{ runner.temp }}/local-llm-router.tar
retention-days: 14

Loading