Skip to content

Commit

Permalink
add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tomeindl committed Apr 30, 2024
1 parent e5ebe0c commit dbfe0fd
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and publish image

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-test-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: checkout

- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ 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-frontend
registry: ghcr.io
dockerfile: Containerfile
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 dbfe0fd

Please sign in to comment.