Update docker.yml #3
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 Push Docker Image | |
on: | |
push: | |
branches: [ 'master' ] | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ github.sha }} | |
- name: Commit updated deployment files | |
run: | | |
IMAGE_TAG="ghcr.io/${{ github.repository }}:${{ github.sha }}" | |
# cd manifests | |
# sed -i "s|ghcr.io/tel-ran-de/chatty-api:.*|${IMAGE_TAG}|g" deployment.yaml | |
git config user.name "GitHub Actions" | |
git config user.email "actions@github.com" | |
git commit -a -m "Update Docker image tag to ${IMAGE_TAG}" | |
- name: Push changes | |
run: | | |
git push origin master |