Merge pull request #1 from SupportTools/dependabot/go_modules/google.… #12
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, Test and Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-test-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/golang@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
args: --sarif-file-output=snyk.sarif | |
- name: Upload result to GitHub Code Scanning | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: snyk.sarif | |
- name: Docker build and push | |
run: | | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
docker buildx build \ | |
--platform linux/amd64 \ | |
--pull \ | |
--build-arg VERSION=${GITHUB_RUN_NUMBER} \ | |
--build-arg GIT_COMMIT=${DRONE_COMMIT_SHA} \ | |
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ | |
--cache-from supporttools/go-sql-proxy:latest \ | |
-t supporttools/go-sql-proxy:"0.2.${{ github.run_number }}" \ | |
-t supporttools/go-sql-proxy:latest \ | |
--push \ | |
-f Dockerfile . | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.7.1 | |
- name: Package Helm chart | |
run: | | |
export CHART_VERSION="0.2.${{ github.run_number }}" | |
export APP_VERSION="0.2.${{ github.run_number }}" | |
export IMAGE_TAG="0.2.${{ github.run_number }}" | |
echo "CHART_VERSION=${CHART_VERSION}" | |
echo "APP_VERSION=${APP_VERSION}" | |
envsubst < charts/go-sql-proxy/Chart.yaml.template > charts/go-sql-proxy/Chart.yaml | |
envsubst < charts/go-sql-proxy/values.yaml.template > charts/go-sql-proxy/values.yaml | |
helm package charts/go-sql-proxy --destination helm/repo | |
- name: Checkout helm-chart repository | |
uses: actions/checkout@v2 | |
with: | |
repository: SupportTools/helm-chart | |
path: helm-chart | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
- name: Update Helm repository | |
run: | | |
cp helm/repo/go-sql-proxy-*.tgz helm-chart/ | |
cd helm-chart | |
helm repo index . --url https://charts.support.tools/ | |
git add . | |
git commit -m "Update Helm chart for go-sql-proxy" | |
git push |