Skip to content

Build ghcr.io/golang-cz/static-analysis:latest along with specific do… #13

Build ghcr.io/golang-cz/static-analysis:latest along with specific do…

Build ghcr.io/golang-cz/static-analysis:latest along with specific do… #13

Workflow file for this run

name: Build static analysis tool with custom plugins
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Git clone
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Log into Github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Docker build
run: |
PULL_REQUEST_ID=${{ github.event.number }}
export COMMIT="$(git log -1 --pretty=format:'%h')"
export VERSION="$(date -d @$(git log -n1 --format=%at) +'v%-y.%-m.%-d')-${COMMIT}${PULL_REQUEST_ID:+-PR-$PULL_REQUEST_ID}"
docker build -t ghcr.io/golang-cz/static-analysis:$VERSION -t ghcr.io/golang-cz/static-analysis:latest .
docker push ghcr.io/golang-cz/static-analysis:$VERSION
docker push ghcr.io/golang-cz/static-analysis:latest