fix readme #4
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: Publish to GitHub Container Registry | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- publish_container | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Log in to GitHub Container Registry | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Step 3: Set up repository name and organization | |
- name: Set up repository info | |
run: | | |
echo "REPO_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
echo "ORG_NAME=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
# Step 4: Build the Docker image | |
- name: Build Docker Image | |
run: | | |
echo "Building image: ghcr.io/${ORG_NAME}/${REPO_NAME}:latest" | |
docker build -t ghcr.io/${ORG_NAME}/${REPO_NAME}:latest . | |
# Step 5: Push the Docker image | |
- name: Push Docker Image | |
run: | | |
echo "Pushing image: ghcr.io/${ORG_NAME}/${REPO_NAME}:latest" | |
docker push ghcr.io/${ORG_NAME}/${REPO_NAME}:latest |