prepare push to dockerhub #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Verification Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
# docker run --rm -it -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.43.1 \ | |
# --with github.com/mostafa/xk6-kafka@v0.17.0 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.22' # The Go version to download (if necessary) and use. | |
- name: install xk6 | |
run: go install go.k6.io/xk6/cmd/xk6@latest | |
- name: create k6 executable | |
run: xk6 build --with github.com/LeonAdato/xk6-output-statsd | |
# - name: build image | |
# run: docker build -t k6-statsd . | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# docker tag <name of the image> <dockerhub username> <name of your repo> <version> | |
- name: Set outputs for docker build | |
id: vars | |
run: | | |
echo "image_name=${{ github.repository }}" >> $GITHUB_OUTPUT | |
echo "image_tag=$(git rev-parse --short HEAD)-${{ github.run_id }}" >> $GITHUB_OUTPUT | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker image and push to GitHub Container Registry | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: false | |
tags: ${{ steps.vars.outputs.image_name }}:latest, ${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.image_tag }} |