Skip to content

add docker build and publish step #18

add docker build and publish step

add docker build and publish step #18

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install ledger
run: |
sudo apt-get install -y ledger
- name: Test
run: go test -v ./...
env:
GITHUB_URL: ${{ secrets.GIT_URL }}
GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: build and publish image
if: ${{ github.ref == 'refs/heads/master' }}
env:
# DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
# DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
run: |

Check failure on line 44 in .github/workflows/go.yml

View workflow run for this annotation

GitHub Actions / Go

Invalid workflow file

The workflow is not valid. .github/workflows/go.yml (Line: 44, Col: 12): Unrecognized named-value: 'DOCKER_HUB_USER'. Located at position 1 within expression: DOCKER_HUB_USER
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
version=${ref}-${GITHUB_SHA:0:7}-$(date +%Y%m%dT%H:%M:%S)
echo "GITHUB_REF=${GITHUB_REF}, GITHUB_SHA=${GITHUB_SHA}, GIT_BRANCH=${ref}"
echo "version=${version}"
echo ${DOCKER_HUB_TOKEN} | docker login -u ${DOCKER_HUB_USER} --password-stdin
docker buildx build --push \
--build-arg VERSION=${version}
--platform linux/amd64,linux/arm/v7,linux/arm64 \
-t ${{DOCKER_HUB_USER}}/teledger:${ref} .