Skip to content

Commit

Permalink
publish container
Browse files Browse the repository at this point in the history
  • Loading branch information
modagent committed Dec 6, 2024
1 parent 02405a2 commit b1ff226
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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

0 comments on commit b1ff226

Please sign in to comment.