Skip to content

Commit

Permalink
Update build-and-release.yaml
Browse files Browse the repository at this point in the history
Ref: #34
  • Loading branch information
projkov authored Apr 21, 2024
1 parent 85e24f2 commit ab00579
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,33 @@ on:
workflows: [Automated Quality Control]
branches: [master]
types: [completed]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Packages
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.repository_owner }} --password-stdin
- name: Build latest Docker image
run: docker build -t docker.pkg.github.com/${{ github.repository }}/inferno:latest .
- name: Push latest Docker image
run: docker push docker.pkg.github.com/${{ github.repository }}/inferno:latest
- name: Build SHA Docker image
run: docker build -t docker.pkg.github.com/${{ github.repository }}/inferno:$GITHUB_SHA .
- name: Push SHA Docker image
run: docker push docker.pkg.github.com/${{ github.repository }}/inferno:$GITHUB_SHA
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image (With commit hash)
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit ab00579

Please sign in to comment.