ci: fix go version parser #64
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: Publish | |
on: [push, pull_request] | |
jobs: | |
test: | |
services: | |
mongodb: | |
image: mongo:4 | |
ports: | |
- 27017:27017 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- run: make test | |
publish: | |
needs: | |
- test | |
name: Publish | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: Surgo/docker-smart-tag-action@v1 | |
id: smarttag | |
with: | |
docker_image: "tsuru/acl-api" | |
default_branch: main | |
tag_with_sha: "true" | |
- name: Handle smart-tag to proper tag var | |
uses: actions/github-script@v6 | |
id: handle_tag | |
with: | |
script: | | |
var tag_re = /:/g | |
var orig_tags = `${{steps.smarttag.outputs.tag}}` | |
return orig_tags.replace(tag_re,"") | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- uses: docker/build-push-action@v5 | |
with: | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.handle_tag.outputs.result }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
platforms: linux/amd64,linux/arm64 |