Skip to content

Commit

Permalink
Invoketemplatewf (#11)
Browse files Browse the repository at this point in the history
Invoke reusable workflows
  • Loading branch information
thunderbirdgit authored Aug 28, 2024
1 parent 2b1f3d2 commit fc1c7d4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 20 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/docker-image.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Perform Precommit Steps

on:
push:
branches:
- '**'
pull_request:
branches: [ "main" ]
types: [closed]

jobs:
determine-branch:
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.get_branch.outputs.branch_name }}
steps:
- name: Get Branch Name
id: get_branch
run: |
if [ "${{ github.event_name }}" == "push" ]; then
branch_name=${GITHUB_REF#refs/heads/}
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "branch_name=${{ github.head_ref }}" >> $GITHUB_OUTPUT
fi
- name: Print Final Branch Name
run: |
echo "Branch Name: ${{ steps.get_branch.outputs.branch_name }}"
get-short-sha:
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.get_sha.outputs.short_sha }}
steps:
- name: Show Short Git SHA
id: get_sha
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "short_sha=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
elif [ "${{ github.event.pull_request.merged }}" == true ]; then
echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
fi
- name: Print Short Git SHA
run: |
echo "Git SHA: ${{ steps.get_sha.outputs.short_sha }}"
build:
strategy:
matrix:
service_name: ["hw-ui-service", "hw-ui-service2"]
needs: [get-short-sha, determine-branch]
uses: thunderbirdgit/gh-actions-wf/.github/workflows/nodejs-build.yml@main
with:
service_name: ${{matrix.service_name}}
short_sha: ${{ needs.get-short-sha.outputs.short_sha }}
branch_name: ${{ needs.determine-branch.outputs.branch_name }}

0 comments on commit fc1c7d4

Please sign in to comment.