Skip to content

update github workflows #18

update github workflows

update github workflows #18

Workflow file for this run

name: publish-docker
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build:
name: docker-publish
runs-on: ubuntu-latest
steps:
- name: Src Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
check-latest: true
id: go
- name: Tests
if: success()
env:
GOPROXY: "https://proxy.golang.org"
run: make test
- name: Build
if: success()
env:
GOPROXY: "https://proxy.golang.org"
run: make build
- name: Build Container
if: success()
run: |
TAG=$(git describe --tags)
docker build -f examples/Dockerfile -t cactus4docker/go-camo:${TAG} .
# also tag as latest?
# docker tag cactus4docker/go-camo:${TAG} cactus4docker/go-camo:latest
- name: Publish Container
if: success()
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
TAG=$(git describe --tags)
LATEST_TAG=$(git tag -l | grep -viE '(alpha|beta)' | sort -V | tail -n 1)
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push cactus4docker/go-camo:${TAG}
if [[ "$TAG" = "$LATEST_TAG" ]]; then
docker tag cactus4docker/go-camo:${TAG} cactus4docker/go-camo:latest
docker push cactus4docker/go-camo:latest
fi
docker logout