Skip to content

Commit

Permalink
docker-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
artek-koltun committed Aug 30, 2023
1 parent b494e41 commit 1c9c82b
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: Docker

on:
workflow_dispatch:
workflow_call:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/[email protected]

- name: Log in to the GH Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get tag
id: repository
run: echo "tag=$(git rev-parse --short HEAD)" > $GITHUB_ENV

- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Get opi-api-version
id: opi_api_version
run: echo "::set-output name=value::$(go list -m -f '{{.Version}}' github.com/opiproject/opi-api)"

- name: Get opi-api Version Info
run: echo "OPI_API_VERSION=$(go list -m -f '{{.Version}}' github.com/opiproject/opi-api)" >> $GITHUB_ENV

- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
${{ steps.meta.outputs.labels }},
opi-api-version=${{ env.OPI_API_VERSION }}

0 comments on commit 1c9c82b

Please sign in to comment.