Skip to content

Commit

Permalink
Add build workflow (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa authored Apr 22, 2022
1 parent 6b5c295 commit 80918cb
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and publish xk6-kafka

on:
push:
tags:
- "v*"

jobs:
build:
name: Build xk6-kafka
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build 🏗️
id: build
uses: szkiba/xk6bundler@v0
with:
platform: linux/amd64 windows/amd64 darwin/amd64
with: |
github.com/mostafa/xk6-kafka@latest
- name: Create Release 📦
uses: softprops/action-gh-release@v1
with:
files: dist/*.tar.gz

- name: Docker meta 📝
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.build.outputs.name }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to DockerHub 🔒
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker build and push ☁️
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v2
with:
push: true
context: ./${{ steps.build.outputs.dockerdir }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 80918cb

Please sign in to comment.