Skip to content

Commit 5e30b3c

Browse files
authored
Merge pull request #211 from TAMULib/wui-version-github
Improve handling of local Weaver-UI-Core repo, adding support for detecting the branch or tag name.
2 parents 5e6d117 + fbeccda commit 5e30b3c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/build.yml

+25
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Build
22

33
on: [ push, pull_request, workflow_dispatch ]
44

5+
env:
6+
CI_WUI_BRANCH: ${{ vars.CI_WUI_BRANCH }}
7+
CI_WUI_DISABLE_LOCAL_PUBLISH: ${{ vars.CI_WUI_DISABLE_LOCAL_PUBLISH }}
8+
59
jobs:
610
build:
711
runs-on: ubuntu-latest
@@ -18,11 +22,32 @@ jobs:
1822
repository: TAMULib/Weaver-UI-Core
1923
path: weaver-ui
2024
ref: 2.x
25+
# Specify depth of 0 to enable fetching all branches and tags so that the "Use Custom Weaver-UI-Core Repo Version" works.
26+
fetch-depth: 0
27+
28+
- name: "Detect Custom Weaver-UI-Core Repo Version"
29+
continue-on-error: true
30+
if: ${{ env.CI_WUI_BRANCH == '' }}
31+
run: |
32+
cd weaver-ui
33+
export CI_WUI_BRANCH_VERSION=$(grep -so -m 1 '"@wvr/core": "[^"]*"' ../repo/package.json | sed -e 's|"@wvr/core": "||' -e 's|"$||')
34+
export CI_WUI_BRANCH=$(git tag | grep -so -m 1 "^$CI_WUI_BRANCH_VERSION$")
35+
# Some projects prefix their version with a "v".
36+
if [[ $CI_WUI_BRANCH == "" && $CI_WUI_BRANCH_VERSION != "" ]] ; then export CI_WUI_BRANCH=$(git tag | grep -so -m 1 "^v$CI_WUI_BRANCH_VERSION$") ; fi
37+
echo "CI_WUI_BRANCH=$CI_WUI_BRANCH" >> $GITHUB_ENV
38+
39+
- name: "Use Custom Weaver-UI-Core Repo Version"
40+
continue-on-error: true
41+
if: ${{ env.CI_WUI_BRANCH != '' }}
42+
run: |
43+
cd weaver-ui
44+
git reset --hard $CI_WUI_BRANCH
2145
2246
- name: "Run Weaver-UI-Core Docker Compose Registry Image"
2347
run: docker-compose -f $GITHUB_WORKSPACE/weaver-ui/docker-compose.yml up -d registry
2448

2549
- name: "Publish Weaver-UI-Core (@wvr/core)"
50+
if: ${{ env.CI_WUI_DISABLE_LOCAL_PUBLISH != 'true' }}
2651
run: |
2752
cd $GITHUB_WORKSPACE/weaver-ui
2853
npm run publish:local

0 commit comments

Comments
 (0)