Skip to content

Set build args

Set build args #4

Workflow file for this run

name: Build, Test, and Push Docker Image
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get the version from the tag
id: get_version
run: |
VERSION=${GITHUB_REF##*/}
VERSION=${VERSION#v}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Install ocl-icd-opencl-dev
run: |
sudo apt-get update && sudo apt-get install -y ocl-icd-opencl-dev
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Tests
run: |
go test -v -parallel 1 $(go list -f '{{.Dir}}/...' -m | xargs)
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: bananocoin/pippin:latest,bananocoin/pippin:${{ env.VERSION }}
build-args: VERSION=${{ env.VERSION }}