Skip to content

Added commit hash to tags. #160

Added commit hash to tags.

Added commit hash to tags. #160

name: Build and Publish
on:
# run it on push to the default repository branch
push:
branches: [master]
# run it during pull request
pull_request:
jobs:
# define job to build and publish docker image
build-and-push-docker-image:
strategy:
matrix:
services:
- name: apm/rancher
directory: APM.Rancher
- name: api
directory: APC.API
- name: scheduler
directory: APC.Scheduler
- name: ingestion
directory: APC.Ingestion
- name: apm/container
directory: APM.Container
- name: apm/npm
directory: APM.Npm
- name: apm/jetbrains
directory: APM.Jetbrains
- name: apm/jetbrains/ide
directory: APM.Jetbrains.IDE
- name: apm/nuget
directory: APM.Nuget
- name: apm/maven
directory: APM.Maven
- name: apm/pypi
directory: APM.Pypi
- name: apm/helm
directory: APM.Helm
- name: acm/http
directory: ACM.Http
- name: acm/git
directory: ACM.Git
- name: acm/router
directory: ACM.Router
- name: acm/container
directory: ACM.Container
name: Build Docker image and push to repositories
# run only when code is compiling and tests are passing
runs-on: ubuntu-latest
# steps to perform in job
steps:
- name: Checkout code
uses: actions/checkout@v3
# setup Docker buld action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to Docker Hub and GitHub Container Registry
uses: docker/build-push-action@v4
with:
# relative path to the place where source code with Dockerfile is located
context: .
file: ./${{ matrix.services.directory }}/Dockerfile
# Note: tags has to be all lower-case
tags: |

Check failure on line 92 in .github/workflows/build-and-publish.yml

View workflow run for this annotation

GitHub Actions / Build and Publish

Invalid workflow file

The workflow is not valid. .github/workflows/build-and-publish.yml (Line: 92, Col: 17): Unrecognized named-value: 'GITHUB_SHA'. Located at position 1 within expression: GITHUB_SHA
ghcr.io/linus-berg/apc/${{ matrix.services.name }}:latest
ghcr.io/linus-berg/apc/${{ matrix.services.name }}:${{ GITHUB_SHA }}
# build on feature branches, push only on main branch
push: ${{ github.ref == 'refs/heads/master' }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}