Skip to content

Commit

Permalink
Merge pull request #22 from MDZZ110/enhance/add-workflows
Browse files Browse the repository at this point in the history
add build image workflow file
  • Loading branch information
MDZZ110 authored Nov 14, 2024
2 parents 720397d + 1c48946 commit 3e2b4cb
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/op-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: BuildContainerImage

on:
push:
branches:
- '*'
# Keep it only for test purpose, comment it once everything is ok
workflow_dispatch:

env:
# TODO: Change variable to your image's repo.
IMAGE_REPO: ${{ vars.IMAGE_REPO }}
IMAGE_VERSION: latest

jobs:
build:
name: Build
runs-on: self-hosted

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Log into registry
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ vars.DOCKER_USERNAME }} --password-stdin ${{ vars.IMAGE_REPO }}

- name: Declare some variables
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
echo "suffix=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
# echo "suffix=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Build and push docker images
run: |
REPO=$IMAGE_REPO TAG="${{ env.branch }}-${{ env.suffix }}" make container-push

0 comments on commit 3e2b4cb

Please sign in to comment.