Skip to content

adjusting perms

adjusting perms #6

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
packages: write # Grant write permissions for packages
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set environment variables
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
docker build -t ghcr.io/$REPO_OWNER/demo-app:${{ github.sha }} .
- name: Push Docker image
run: |
docker push ghcr.io/$REPO_OWNER/demo-app:${{ github.sha }}
- name: Output image tag
run: |
echo "Image: ghcr.io/$REPO_OWNER/demo-app:${{ github.sha }}"