Skip to content

Commit

Permalink
Push image to GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli committed Jul 11, 2024
1 parent 452c07e commit ad350c3
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- main
tags:
- "v*"

jobs:
test:
Expand All @@ -27,3 +29,46 @@ jobs:

- name: Run tests
run: pnpm test

push:
needs: test
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE_NAME: cmioc
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata from Git refs and GitHub events
id: extract_metadata
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build machine image and push it to GitHub Container Registry
uses: docker/build-push-action@v6
with:
context: .
push: true
builder: ${{ steps.setup_buildx.outputs.name }}
tags: ${{ steps.extract_metadata.outputs.tags }}
labels: ${{ steps.extract_metadata.lables.labels }}
cache-from: type=gha,scope=ubuntu
cache-to: type=gha,mode=max,scope=ubuntu

0 comments on commit ad350c3

Please sign in to comment.