Merge pull request #22 from koenighotze/snyk-fix-99e9011a06007acb1b12… #24
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: Build main or features | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
workflow_dispatch: | |
jobs: | |
qa: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checking out | |
uses: actions/checkout@v4 | |
- name: Scaning code | |
uses: aquasecurity/trivy-action@0.12.0 | |
with: | |
scan-type: "fs" | |
ignore-unfixed: true | |
format: "table" | |
template: "@/contrib/sarif.tpl" | |
severity: "MEDIUM,HIGH,CRITICAL" | |
- name: Detecting secrets | |
uses: reviewdog/action-detect-secrets@v0.12 | |
with: | |
reporter: github-check | |
github_token: ${{ secrets.github_token }} | |
fail_on_error: true | |
detect_secrets_flags: --exclude-files .git | |
build-container: | |
needs: | |
- qa | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checking out | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build image | |
id: build-image | |
uses: docker/build-push-action@v4 | |
with: | |
tags: ${{ github.repository }}:${{ github.sha }} | |
load: true | |
- name: Scaning image | |
uses: aquasecurity/trivy-action@0.12.0 | |
with: | |
image-ref: ${{ github.repository }}:${{ github.sha }} | |
format: "table" | |
exit-code: "1" | |
ignore-unfixed: true | |
severity: "MEDIUM,HIGH,CRITICAL" | |
vuln-type: "os,library" | |
- name: Try running image | |
run: | | |
docker run --rm ${{ github.repository }}:${{ github.sha }} | |
push-tagged-image: | |
needs: | |
- build-container | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checking out | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Dockerhub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_LOGIN }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
${{ github.repository }}:${{ github.sha }} | |
${{ github.repository }}:${{ github.ref_name }} | |
labels: | | |
org.opencontainers.image.authors=@Koenighotze | |
org.opencontainers.image.name=${{ github.repository }} | |
org.opencontainers.image.title=Wordcloud-cli docker wrapper | |
org.opencontainers.image.source=${{ github.repositoryUrl }} | |
org.opencontainers.image.revision=${{ github.sha }} |