Incorporate SARIF option and update CI test and docs #155
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: docker | |
on: push | |
jobs: | |
docker: | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push (for master branch) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
id: docker_build_master | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository }}:latest | |
- name: Find tag and save it to variable with set output (for tags) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Build and push (for tags) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
id: docker_build_tag | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.tag }} | |
- name: Update action.yml (for tags) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: fjogeleit/yaml-update-action@v0.13.1 | |
with: | |
valueFile: action.yml | |
propertyPath: runs.image | |
value: docker://ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.tag }} | |
quotingType: '"' | |
commitChange: true | |
createPR: false | |
branch: ${{ steps.vars.outputs.tag }} | |
message: Use ${{ steps.vars.outputs.tag }} Docker image tag in action.yml | |
- name: Draft a new GitHub release (for tags) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true |