[Snyk] Fix for 4 vulnerabilities #150
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 Image | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
workflow_run: | |
workflows: [ "Run Tests" ] | |
types: | |
- completed | |
env: | |
PROJECT_ID: crank-404520 | |
SERVICE: crank | |
REGION: us-west1 | |
ARTIFACT_REPO: crank-repository | |
jobs: | |
build-image: | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'write' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if last commit was a merge commit | |
id: check | |
run: | | |
if [[ "$(git log --merges -1 --pretty=%H)" != "$(git log -1 --pretty=%H)" ]]; then | |
echo "This was not a merge commit. Exiting..." | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: 'Authenticate with GitHub Container Registry' | |
uses: 'docker/login-action@v1' | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Build and Push Container to GitHub Container Registry' | |
uses: 'docker/build-push-action@v5' | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ github.repository }}/${{ env.SERVICE }}:${{ github.sha }} |