Skip to content

copy paste from docs #3

copy paste from docs

copy paste from docs #3

Workflow file for this run

name: Build test project
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
init:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
go-version: [ '1.21.6' ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# tags: ${{ github.repository }}
# labels: ${{ steps.meta.outputs.labels }}
# - name: Setup Go ${{ matrix.go-version }}
# uses: actions/setup-go@v4
# with:
# go-version: ${{ matrix.go-version }}
# - name: Display Go version
# run: go version