activate push to dockerhub #23
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: | |
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 binary | |
run: xk6 build --with github.com/LeonAdato/xk6-output-statsd | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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_OUTPUT | |
- name: Login to Image Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Build Docker image and push to dockerhub | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 ,linux/arm64 | |
push: true | |
tags: ${{ steps.vars.outputs.image_name }}:latest, ${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.image_tag }} |