-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (45 loc) · 1.51 KB
/
docker.yaml
File metadata and controls
48 lines (45 loc) · 1.51 KB
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
permissions:
contents: read
packages: write
on:
release:
types: [created]
workflow_dispatch:
inputs:
environment:
description: 'Select the environment'
required: true
default: 'production'
type: choice
options:
- production
- staging
branch:
description: 'Select the branch'
required: true
default: 'main'
name: Build docker image
jobs:
build:
name: KernelCI Storage Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: Retrieve github username
run: echo "${{ github.actor }}" > github_username.txt
- name: Set name of docker image on staging
if: ${{ github.event.inputs.environment == 'staging' }}
run: echo "ghcr.io/${{ github.repository_owner }}/kernelci-storage:staging" > image_name.txt
- name: Set name of docker image on production
if: ${{ github.event.inputs.environment == 'production' }}
run: echo "ghcr.io/${{ github.repository_owner }}/kernelci-storage:latest" > image_name.txt
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push
run: |
docker buildx build --platform linux/amd64 -t $(cat image_name.txt) --push .