Skip to content

Commit 299c6d2

Browse files
authored
Merge pull request #12 from nuclearcat/improve-workflows
feat: Add workflow to build staging version
2 parents 1d45e52 + 7878ea7 commit 299c6d2

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

.github/workflows/docker.yaml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
1+
permissions:
2+
contents: read
3+
packages: write
4+
15
on:
26
release:
37
types: [created]
48
workflow_dispatch:
5-
9+
inputs:
10+
environment:
11+
description: 'Select the environment'
12+
required: true
13+
default: 'production'
14+
type: choice
15+
options:
16+
- production
17+
- staging
18+
branch:
19+
description: 'Select the branch'
20+
required: true
21+
default: 'main'
22+
623
name: Build docker image
724
jobs:
825
build:
926
name: KernelCI Storage Docker image
1027
runs-on: ubuntu-latest
1128
steps:
1229
- uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
ref: ${{ github.event.inputs.branch }}
33+
- name: Retrieve github username
34+
run: echo "${{ github.actor }}" > github_username.txt
35+
- name: Set name of docker image on staging
36+
if: ${{ github.event.inputs.environment == 'staging' }}
37+
run: echo "ghcr.io/${{ github.actor }}/kernelci-storage:staging" > image_name.txt
38+
- name: Set name of docker image on production
39+
if: ${{ github.event.inputs.environment == 'production' }}
40+
run: echo "ghcr.io/${{ github.actor }}/kernelci-storage:latest" > image_name.txt
1341
- name: Set up Docker Buildx
1442
uses: docker/setup-buildx-action@v3
1543
- name: Login to ghcr.io
1644
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
1745
- name: Build and push
18-
# running ARM64 will take a long time (1hr+), so we only build for AMD64 for now
19-
# run: |
20-
# docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/nuclearcat/kernelci-storage:latest --push .
2146
run: |
22-
docker buildx build --platform linux/amd64 -t ghcr.io/kernelci/kernelci-storage:latest --push .
47+
docker buildx build --platform linux/amd64 -t $(cat image_name.txt) --push .
2348

0 commit comments

Comments
 (0)