Skip to content

Moved cache operations to the application layer #72

Moved cache operations to the application layer

Moved cache operations to the application layer #72

Workflow file for this run

name: Docker Build & Push
on:
push:
branches:
- '**'
tags:
- '**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Run tests
run: go test -v ./...
- name: Run benchmark tests
run: go test -bench=. -benchmem ./internal/infrastructure/cache/...
build-and-push:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
run: |
IMAGE_NAME="1010s/shared-lock"
BRANCH_NAME=$(echo "${{ github.ref }}" | sed 's|refs/heads/||; s|refs/tags/||')
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG_NAME=$(echo "${{ github.ref }}" | sed 's|refs/tags/||')
TAGS="$IMAGE_NAME:$TAG_NAME,$IMAGE_NAME:$SHORT_SHA"
else
TAGS="$IMAGE_NAME:$BRANCH_NAME,$IMAGE_NAME:$SHORT_SHA"
fi
echo "TAGS=$TAGS" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
file: deployment/Dockerfile
push: true
tags: ${{ env.TAGS }}