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
53 changes: 53 additions & 0 deletions .github/workflows/crates-sync-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Crates Sync deploy

on:
push:
branches:
- main
paths:
- ".github/workflows/crates-sync-deploy.yml"
- "scripts/crates-sync/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
REPOSITORY: mega/crates-sync
IMAGE_TAG: latest
HARBOR_REGISTRY: registry.xuanwu.openatom.cn

jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: ${{ env.HARBOR_REGISTRY }}
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}

- name: Build, tag, and push docker image to Harbor
run: |
set -euo pipefail

HARBOR_IMAGE_BASE="${{ env.HARBOR_REGISTRY }}/${{ env.REPOSITORY }}"
IMAGE_TAG="${{ env.IMAGE_TAG }}"
SHORT_SHA="${GITHUB_SHA:0:7}"

docker build \
-f scripts/crates-sync/Dockerfile \
-t "$HARBOR_IMAGE_BASE:$IMAGE_TAG" \
-t "$HARBOR_IMAGE_BASE:$SHORT_SHA" \
scripts/crates-sync

docker push "$HARBOR_IMAGE_BASE:$IMAGE_TAG"
docker push "$HARBOR_IMAGE_BASE:$SHORT_SHA"
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
context: .
dockerfile: scripts/init_mega/Dockerfile

- name: crates-sync
context: scripts/crates-sync
dockerfile: scripts/crates-sync/Dockerfile

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
Loading
Loading