Merge pull request #14 from opensource-force/dev/favicon #6
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 and Deploy to GitHub Packages | |
on: | |
push: | |
branches: | |
- main # Adjust to your default branch | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- 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 Docker Buildx for multi-platform builds (optional but recommended) | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Step 4: Build and push the Docker image to GitHub Container Registry | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/osf-site:latest | |
ghcr.io/${{ github.repository_owner }}/osf-site:${{ github.sha }} | |
# Step 5: Optional - Clean up unused Docker resources on the runner | |
- name: Prune Docker | |
run: docker system prune --all --force |