Skip to content

Commit 4eae825

Browse files
new workflow
1 parent 9e117c0 commit 4eae825

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Push k8s Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
runtime:
7+
description: 'Runtime image'
8+
required: true
9+
default: 'hackmdio/runtime:16.20.2-35fe7e39'
10+
buildpack:
11+
description: 'Buildpack image'
12+
required: true
13+
default: 'hackmdio/buildpack:16.20.2-35fe7e39'
14+
push:
15+
tags:
16+
- '*'
17+
branches:
18+
- k8s
19+
20+
env:
21+
REGISTRY_IMAGE: demo-images/codimd
22+
jobs:
23+
build-and-push:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout source
28+
uses: actions/checkout@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Log in to Docker registry
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.NEXUS_USERNAME }}
37+
password: ${{ secrets.NEXUS_PASSWORD }}
38+
registry: ${{ secrets.NEXUS_REGISTRY }}
39+
40+
- name: Determine tag
41+
id: tag
42+
run: |
43+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
44+
echo "IMAGETAG=k8s-${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
45+
else
46+
echo "IMAGETAG=k8s-latest" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Build and push Docker image
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: .
53+
file: deployments/Dockerfile
54+
push: true
55+
tags: ${{ secrets.NEXUS_REGISTRY }}/${{ env.REGISTRY_IMAGE }}:${{ steps.tag.outputs.IMAGETAG }}
56+
build-args: |
57+
RUNTIME=${{ github.event.inputs.runtime || 'hackmdio/runtime:16.20.2-35fe7e39' }}
58+
BUILDPACK=${{ github.event.inputs.buildpack || 'hackmdio/buildpack:16.20.2-35fe7e39' }}

0 commit comments

Comments
 (0)