|
4 | 4 | branches:
|
5 | 5 | - main
|
6 | 6 | paths:
|
| 7 | + - ".github/workflows/python-api-diffusers-cd.yaml" |
7 | 8 | - "docker_images/diffusers/**"
|
| 9 | +concurrency: |
| 10 | + group: diffusers-cd-${{ github.head_ref }} |
| 11 | + cancel-in-progress: true |
8 | 12 | jobs:
|
9 | 13 | build:
|
10 | 14 | runs-on: ubuntu-latest
|
| 15 | + permissions: |
| 16 | + packages: write |
| 17 | + contents: read |
11 | 18 | steps:
|
12 |
| - - name: Set up Python ${{ matrix.python-version }} |
13 |
| - uses: actions/setup-python@v2 |
14 |
| - with: |
15 |
| - python-version: "3.8" |
16 | 19 | - name: Checkout
|
17 |
| - uses: actions/checkout@v2 |
18 |
| - - name: Set up QEMU |
19 |
| - uses: docker/setup-qemu-action@v1 |
| 20 | + uses: actions/checkout@v4.1.7 |
| 21 | + - name: Inject slug/short variables |
| 22 | + uses: rlespinasse/github-slug-action@v4.5.0 |
20 | 23 | - name: Set up Docker Buildx
|
21 |
| - uses: docker/setup-buildx-action@v1 |
22 |
| - - name: Install dependencies |
| 24 | + uses: docker/setup-buildx-action@v3.6.1 |
| 25 | + - name: downcase REPO |
23 | 26 | run: |
|
24 |
| - pip install --upgrade pip |
25 |
| - pip install awscli |
26 |
| - - uses: tailscale/github-action@v1 |
| 27 | + echo "CONTAINER_REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} |
| 28 | + - name: Docker meta |
| 29 | + id: meta |
| 30 | + |
27 | 31 | with:
|
28 |
| - authkey: ${{ secrets.TAILSCALE_AUTHKEY }} |
29 |
| - - name: Update upstream |
30 |
| - env: |
31 |
| - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
32 |
| - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
33 |
| - AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} |
34 |
| - DEFAULT_HOSTNAME: ${{ secrets.DEFAULT_HOSTNAME }} |
35 |
| - REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} |
36 |
| - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} |
37 |
| - run: | |
38 |
| - python build_docker.py diffusers --out out.txt |
39 |
| - - name: Deploy on API (CPU + GPU) |
40 |
| - run: | |
41 |
| - # Load the tags into the env |
42 |
| - cat out.txt >> $GITHUB_ENV |
43 |
| - export $(xargs < out.txt) |
44 |
| - echo ${DIFFUSERS_CPU_TAG} |
45 |
| - # Weird single quote escape mechanism because string interpolation does |
46 |
| - # not work on single quote in bash |
47 |
| - curl -H "Authorization: Bearer ${{ secrets.API_GITHUB_TOKEN }}" https://api.github.com/repos/huggingface/api-inference/actions/workflows/update_community.yaml/dispatches -d '{"ref":"main","inputs":{"framework":"DIFFUSERS","tag": "'"${DIFFUSERS_CPU_TAG}"'"}}' |
48 |
| - curl -H "Authorization: Bearer ${{ secrets.API_GITHUB_TOKEN }}" https://api.github.com/repos/huggingface/api-inference/actions/workflows/update_community.yaml/dispatches -d '{"ref":"main","inputs":{"compute": "GPU", "framework":"DIFFUSERS","tag": "'"${DIFFUSERS_CPU_TAG}"'"}}' |
| 32 | + images: ghcr.io/${{ env.CONTAINER_REPO }} |
| 33 | + - name: Login to GitHub Container Registry |
| 34 | + |
| 35 | + with: |
| 36 | + registry: ghcr.io |
| 37 | + username: ${{ github.actor }} |
| 38 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + - name: Build and push Docker image |
| 40 | + id: build-and-push |
| 41 | + |
| 42 | + with: |
| 43 | + context: docker_images/diffusers |
| 44 | + push: true |
| 45 | + platforms: 'linux/amd64' |
| 46 | + tags: ghcr.io/${{ env.CONTAINER_REPO }}/diffusers:${{ env.GITHUB_SHA_SHORT || steps.meta-pr.outputs.tags }} |
| 47 | + labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} |
| 48 | + # TODO: cache-from/cache-to |
0 commit comments