Update secrets and messaging #13
This file contains hidden or 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: Security Check | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: thirdkeyai/symbi | |
| jobs: | |
| security-check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha,prefix={{branch}}- | |
| - name: Run security check | |
| run: | | |
| # Get the current commit SHA | |
| COMMIT_SHA=$(git rev-parse HEAD) | |
| # Try to pull and run the image with version check | |
| if docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${COMMIT_SHA} 2>/dev/null; then | |
| echo "Found existing image for commit ${COMMIT_SHA}" | |
| docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${COMMIT_SHA} --version | |
| else | |
| echo "Image not found for commit ${COMMIT_SHA}, building locally..." | |
| docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${COMMIT_SHA} . | |
| docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${COMMIT_SHA} --version | |
| fi |