fix(ci): master branch condition to push image #61
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: Docker Image CI | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: docker build . --tag ghcr.io/eol-uchile/portal-eol:${GITHUB_SHA} | |
- name: Login to GitHub Container Registry | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to Github Container Registry | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
docker push ghcr.io/eol-uchile/portal-eol:${GITHUB_SHA} | |