Skip to content

chore: bump module version to 4 (#370) #334

chore: bump module version to 4 (#370)

chore: bump module version to 4 (#370) #334

on:
push:
branches:
- main
pull_request:
name: ci
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# The build job will use the .git directory to
# infer the current version to embed in the binary
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- run: go build
- run: go test -race ./...
build_and_publish_docker_image:
needs: test
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get Docker image tags
id: image_tags
run: |
IMAGE=italia/publiccode-crawler
TAGS=${IMAGE}:latest
TAGS="$TAGS,${IMAGE}:${GITHUB_SHA::8}"
echo ::set-output name=tags::${TAGS}
- name: Build and push
uses: docker/build-push-action@v2
with:
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
push: true
tags: ${{ steps.image_tags.outputs.tags }}