Merge pull request #1 from denisushakov/feature/backend-init #2
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: golang-pipeline | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: golang:1.23 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run Unit Tests | |
env: | |
ENV TODO_DBFILE: /storage/scheduler.db | |
run: GOOS=linux GOARCH=amd64 go test ./... | |
- name: Vet | |
run: | | |
go vet ./... | |
deploy: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: test | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: denisushakov/todo-rest | |
- name: Build and push Docker Inage | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |