-
Notifications
You must be signed in to change notification settings - Fork 314
67 lines (59 loc) · 2.31 KB
/
build_cpu.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: deploy_cpu_docker
# gh workflow run deploy_cpu_docker
# This also runs on release deploy
on:
workflow_dispatch:
release:
types: [published]
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'
jobs:
build-and-push-image:
runs-on: [ubuntu-latest]
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize Docker Buildx
uses: docker/[email protected]
with:
install: true
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta-cpu
uses: docker/[email protected]
with:
images: |
ghcr.io/${{env.GITHUB_REPOSITORY_OWNER_PART}}/${{env.GITHUB_REPOSITORY_NAME_PART}}
flavor: |
latest=false
tags: |
type=semver,pattern=cpu-{{version}}
type=semver,pattern=cpu-{{major}}.{{minor}}
type=raw,value=cpu-latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=raw,value=cpu-sha-${{ env.GITHUB_SHA_SHORT }}
- name: Build and push Docker image
id: build-and-push-cpu
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: 'linux/amd64'
tags: ${{ steps.meta-cpu.outputs.tags }}
labels: ${{ steps.meta-cpu.outputs.labels }}