Skip to content

Commit

Permalink
Implement GH Action to build app
Browse files Browse the repository at this point in the history
* implement a simple action to build and publish image as package in repository
  • Loading branch information
tomeindl authored Apr 29, 2024
1 parent f8b4565 commit eac0e92
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build and publish image

on:
push:
branches:
- main
workflow_dispatch:

jobs:
Expand All @@ -23,18 +26,19 @@ jobs:
${{ runner.os }}-
- uses: nelonoel/branch-name@v1.0.1

- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

#build the image and push it to the registry
- uses: mr-smithers-excellent/docker-build-push@v5
name: push-container-image
with:
image: mega-backend
image: mega-frontend
registry: ghcr.io
username: ${{ github.repository }}
password: ${{ secrets.GHCR_TOKEN }}
dockerfile: Containerfile
addLatest: true
tags: ${{ steps.vars.outputs.sha_short }},latest
buildArgs: BRANCH=${BRANCH_NAME},COMMIT=${{ steps.vars.outputs.sha_short }},VERSION=${{ steps.vars.outputs.sha_short }}
username: ${{ github.repository }}
password: ${{ secrets.GITHUB_TOKEN }}
addLatest: ${{ github.ref == 'refs/heads/main' }}

0 comments on commit eac0e92

Please sign in to comment.