fix: helm chart syntax error and secrets handling #66
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: | |
pull_request: | |
branches: | |
- main | |
push: | |
tags: | |
- v* | |
env: | |
DOCKER_IMAGE_NAME: rundeck-exporter | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build Docker image | |
run: | | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && export VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//') | |
make docker-build | |
- name: Run Trivy vulnerability scanner | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: '${{ env.DOCKER_IMAGE_NAME }}' | |
format: 'table' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
- name: Publish Docker image | |
if: ${{ github.event_name != 'pull_request' }} | |
env: | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && export VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//') | |
# Push docker image:latest if no alfa or beta is set in the version tag. | |
if [[ ! "$VERSION" =~ (alfa|beta) ]]; then | |
VERSION=latest make push-all | |
fi | |
make push-all |