Skip to content

Commit

Permalink
Add 'Build, Test, Push' Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gb-beng committed Mar 8, 2024
1 parent acd6182 commit bd392ab
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-test-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build, Test, Push

on:
push:
- main
workflow_call:

jobs:
build-test-push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract image metadata
id: meta
uses: docker/metadata-action@9dc751fe249ad99385a2583ee0d084c400eee04e # v5.4.0
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push image
id: build
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
push: false
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}

- name: Test image
run: timout 30 docker run ${{ steps.build.imageid }}

- name: Push image
run: docker push --all-tags ${{ steps.build.imageid }}

0 comments on commit bd392ab

Please sign in to comment.