Skip to content

Commit 80918cb

Browse files
authored
Add build workflow (#39)
1 parent 6b5c295 commit 80918cb

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/build.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and publish xk6-kafka
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
name: Build xk6-kafka
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout 🛎️
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Build 🏗️
19+
id: build
20+
uses: szkiba/xk6bundler@v0
21+
with:
22+
platform: linux/amd64 windows/amd64 darwin/amd64
23+
with: |
24+
github.com/mostafa/xk6-kafka@latest
25+
26+
- name: Create Release 📦
27+
uses: softprops/action-gh-release@v1
28+
with:
29+
files: dist/*.tar.gz
30+
31+
- name: Docker meta 📝
32+
id: meta
33+
uses: docker/metadata-action@v3
34+
with:
35+
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.build.outputs.name }}
36+
tags: |
37+
type=semver,pattern={{version}}
38+
type=semver,pattern={{major}}.{{minor}}
39+
type=semver,pattern={{major}}
40+
41+
- name: Login to DockerHub 🔒
42+
uses: docker/login-action@v1
43+
with:
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Docker build and push ☁️
48+
if: startsWith(github.ref, 'refs/tags/')
49+
uses: docker/build-push-action@v2
50+
with:
51+
push: true
52+
context: ./${{ steps.build.outputs.dockerdir }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)