1- # Bringing together dev ymls
1+
22# TODO could share artifacts between jobs to reduce number of builds
33# this should have just been BCLSource %LocalPackagePath% but set locally now
44# would have been better with github environments appsetting setting some of program.cs for wasm
55name : Dev pipeline for test lint packaging artifact and gh-page trigger
66on :
7- # Trigger the workflow for push and pull requests to all branches except 'main' and 'master'
7+ # Trigger the workflow for push requests to all branches except 'main' and 'master'
88 push :
99 branches-ignore :
1010 - ' main'
2525 PACKAGES_TOKEN : ${{ secrets.PACKAGES_TOKEN }}
2626 GITHUB_USERNAME : " Phil-NHS"
2727
28- # DisablePackageGeneration
2928 NUPKG_OUTPUT_PATH : ${{ github.workspace }}/CICDPackageLocation
3029
3130
@@ -132,7 +131,7 @@ jobs:
132131
133132
134133
135- # do we really need to timestamp yeah but not in release so will grep only publish release there
134+
136135 - name : Run Semantic Version (None Blocking)
137136 env :
138137 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -280,16 +279,7 @@ jobs:
280279 echo "Listing packages.lock.json files:"
281280 find . -name "packages.lock.json" -type f -print
282281
283- # need to remove publish on build
284- # - name: Build Solution
285- # run: |
286- # dotnet build GitPageBlazorWASM.sln -c Release \
287- # /p:BCLVersion=$BCL_VERSION \
288- # /p:NupkgOutputPath=$NUPKG_OUTPUT_PATH \
289- # /p:UseBCLProjectReference=$USE_BCL_PROJECT_REFERENCE \
290- # /p:GhPageRelease=false \
291- # /p:LocalPackagePath=$BCL_Source
292- # /p:DisablePackageGeneration=true
282+
293283
294284 - name : Build Shared Pages
295285 run : |
@@ -311,13 +301,7 @@ jobs:
311301 # echo "GITHUB_PACKAGES_TOKEN=$PACKAGES_TOKEN" >> $GITHUB_ENV
312302
313303
314-
315-
316- # /p:INDEPENDENT_CLIENT_GH_PAGES=true \
317- # env:
318- # INDEPENDENT_CLIENT_GH_PAGES: true
319-
320- # Hardcode the INDEPENDENT_CLIENT_GH_PAGES value
304+ # Hardcoding here the INDEPENDENT_CLIENT_GH_PAGES value
321305 - name : Modify appsettings.json with hardcoded value
322306 run : |
323307 jq '.INDEPENDENT_CLIENT_GH_PAGES = "true"' TestHostPrerenderWASM/TestHostPrerenderWASM.Client/wwwroot/appsettings.json > tmp.json && mv tmp.json TestHostPrerenderWASM/TestHostPrerenderWASM.Client/wwwroot/appsettings.json
@@ -406,263 +390,3 @@ jobs:
406390 ls -al ./docs
407391 echo "Checking artifact details:"
408392 gh api "repos/TechnologyEnhancedLearning/GitPageBlazorWASM/actions/runs/${GITHUB_RUN_ID}/artifacts"
409- # Make-Blazor-Wiki-Artifact-Trigger-GH-Pages-In-BlazorWasmTest:
410-
411- # if: success() #not needed but being explicit
412- # needs: [ branch-name-check, build-bcl-dev-package-and-publish,generate-dev-semantic-version, commitlint, gitguardian-scan, Unit-Tests, E2E-Tests]
413- # runs-on: ubuntu-latest
414- # env:
415- # BCL_VERSION: ${{ needs.generate-dev-semantic-version.outputs.dev-package-version }}
416-
417-
418- # steps:
419- # - name: Checkout Code
420- # uses: actions/checkout@v4
421-
422- # - name: Setup .NET
423- # uses: actions/setup-dotnet@v4
424- # with:
425- # global-json-file: global.json
426-
427- # # - name: Setup .NET
428- # # uses: actions/setup-dotnet@v3
429- # # with:
430- # # dotnet-version: '8.0.x'
431-
432-
433-
434- # - name: Remove Local PackageSettings (CI Only)
435- # run: rm -f PackageSettings.props.local
436-
437- # - name: Replace local environment variable in nuget config because cant provide it as a parameter
438- # run: |
439- # echo "sed -i \"s|%LocalPackagePath%|$BCL_Source|g\" nuget.config"
440- # sed -i "s|%LocalPackagePath%|$BCL_Source|g" nuget.config
441- # sed -i "s|%GITHUB_USERNAME%|$GITHUB_USERNAME|g" nuget.config
442- # sed -i "s|%GITHUB_PACKAGES_TOKEN%|$PACKAGES_TOKEN |g" nuget.config
443-
444- # - name: debug BCL_VERSION
445- # run: |
446- # echo "BCL_VERSION $BCL_VERSION"
447-
448- # - name: Clean lock files because the newly generated package file will superseed the locks
449- # run: |
450- # echo "Listing packages.lock.json files:"
451- # find . -name "packages.lock.json" -type f -print
452- # echo ""
453- # echo "Deleting packages.lock.json files:"
454- # find . -name "packages.lock.json" -type f -exec rm -f {} \;
455-
456- # echo "Listing packages.lock.json files:"
457- # find . -name "packages.lock.json" -type f -print
458-
459- # - name: Clean Solution
460- # run: |
461- # echo "Cleaning the solution..."
462- # dotnet clean GitPageBlazorWASM.sln
463-
464- # # - name: Restore NuGet Packages
465- # # run: |
466- # # echo "Restoring NuGet packages..."
467- # # dotnet restore GitPageBlazorWASM.sln
468-
469- #
470- # # fails because clieant as id expect if release
471- # # also fails becuase running at the solution level it does not respect the condition on not using the project reference
472-
473- # # - name: Build Solution
474- # # run: |
475- # # echo "Building the solution..."
476- # # dotnet build GitPageBlazorWASM.sln -c Release \
477- # # /p:BCLVersion=$BCL_VERSION \
478- # # /p:NupkgOutputPath=$NUPKG_OUTPUT_PATH \
479- # # /p:UseBCLProjectReference=$USE_BCL_PROJECT_REFERENCE
480-
481- # - name: Build Shared Pages
482- # run: |
483- # echo "Building the solution..."
484- # dotnet build SharedPages -c Release \
485- # /p:BCLVersion=$BCL_VERSION \
486- # /p:NupkgOutputPath=$NUPKG_OUTPUT_PATH \
487- # /p:UseBCLProjectReference=$USE_BCL_PROJECT_REFERENCE
488-
489- # # - name: Build Shared Pages
490- # # run: |
491- # # dotnet build SharedPages -c Release \
492- # # /p:BCLVersion=$BCL_VERSION \
493- # # /p:NupkgOutputPath=$NUPKG_OUTPUT_PATH \
494- # # /p:UseBCLProjectReference=$USE_BCL_PROJECT_REFERENCE
495-
496- # # - name: Debug Package References
497- # # run: |
498- # # echo "Debugging package references..."
499- # # dotnet restore GitPageBlazorWASM.sln
500- # # dotnet list GitPageBlazorWASM.sln package
501-
502- # - name: Debug Directory package props
503- # run: |
504- # echo "Directory.Packages.props : "
505- # cat Directory.Packages.props
506- # echo ""
507-
508-
509- # # - name: Restoring client, isnt restoring library such that it restores solution enough to get the correct package so restoring the the whole solution
510- # # run: dotnet restore GitPageBlazorWASM.sln
511-
512- # # - name: Restore NuGet Packages for Specifically the BCL Package Library Project
513- # # run: dotnet restore TestHostPrerenderWASM/TestHostPrerenderWASM.Client/TestHostPrerenderWASM.Client.csproj
514-
515- # - name: Debug client values
516- # run: |
517- # echo "IsLocalDev: $IS_LOCAL_DEV"
518- # echo "BCLVersion: $BCL_VERSION"
519- # echo "UseBCLProjectReference: $USE_BCL_PROJECT_REFERENCE"
520-
521-
522-
523- # - name: is it because solution level not receive /p for project so need githun_env values
524- # run: |
525- # echo "BCLVersion=$BCL_VERSION" >> $GITHUB_ENV
526- # echo "LocalPackagePath=$BCL_SOURCE" >> $GITHUB_ENV
527- # echo "GITHUB_USERNAME=$GITHUB_USERNAME" >> $GITHUB_ENV
528- # echo "IsLocalDev=$IS_LOCAL_DEV" >> $GITHUB_ENV
529- # echo "UseBCLProjectReference=$USE_BCL_PROJECT_REFERENCE" >> $GITHUB_ENV
530- # #echo "GITHUB_PACKAGES_TOKEN=$PACKAGES_TOKEN" >> $GITHUB_ENV
531-
532- # - name: now try restore again
533- # run: |
534- # dotnet Restore
535- # cat Directory.Packages.props
536- # echo "doesnt work"
537-
538- # - name: Display Environment Variable (for debugging)
539- # run: echo "BCLVERSION is $BCLVERSION"
540-
541-
542-
543-
544- # - name: Debug artifact location
545- # run: |
546- # # Get the artifact list for the current workflow run
547- # ARTIFACT_LIST=$(gh api "repos/TechnologyEnhancedLearning/GitPageBlazorWASM/actions/runs/${GITHUB_RUN_ID}/artifacts")
548- # # Echo the entire artifact list for debugging purposes
549- # echo "Artifact List: $ARTIFACT_LIST"
550- # # Extract the download URL from the artifact list (first artifact in the list)
551- # #ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[0].archive_download_url')
552- # ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[0].url')
553- # # Echo the artifact URL to confirm
554- # echo "Artifact URL: $ARTIFACT_URL"
555- # echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_ENV
556-
557-
558- # - name: Trigger Workflow in GitPageBlazorWASM-Test Repository
559- # run: |
560- # # Set the required variables
561- # repo_owner="TechnologyEnhancedLearning" # Replace with the repository owner (organization or user)
562- # repo_name="GitPageBlazorWASM-TestGHPage" # Replace with the repository name
563- # event_type="artifact_ready"
564- # #artifact_url="https://api.github.com/repos/TechnologyEnhancedLearning/GitPageBlazorWASM/actions/artifacts/2859947943"
565- # # Trigger the workflow in another repository
566- # curl -L \
567- # -X POST \
568- # -H "Accept: application/vnd.github+json" \
569- # -H "Authorization: Bearer ${{ secrets.PACKAGES_TOKEN }}" \
570- # -H "X-GitHub-Api-Version: 2022-11-28" \
571- # https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
572- # -d "{\"event_type\": \"$event_type\", \"client_payload\": {\"artifact_url\": \"$artifact_url\"}}"
573-
574- # - name: Debug - List all files
575- # run: |
576- # echo "Listing files in the root directory:"
577- # ls -al
578- # echo "Listing files in the docs directory:"
579- # ls -al ./docs
580- # echo "Checking artifact details:"
581- # gh api "repos/TechnologyEnhancedLearning/GitPageBlazorWASM/actions/runs/${GITHUB_RUN_ID}/artifacts"
582-
583- # # No this will be in the release branch that we do a prod wiki host
584- # # - name: Deploy to GitHub Pages
585- # # uses: JamesIves/github-pages-deploy-action@v4
586- # # with:
587- # # folder: docs # The folder the action should deploy
588- # # branch: gh-pages # The branch the action should deploy to
589-
590-
591-
592- # Previously we passed the value
593- # name: Deploy to GitHub Pages
594-
595- # on:
596- # #push:
597- # # branches: [ master ]
598- # workflow_run:
599- # workflows: ["Build BCL Package"] # Name of the workflow to trigger from.
600- # types:
601- # - completed
602-
603- # Same pipeline shouldnt need it now
604- # get-bcl-version:
605- # runs-on: ubuntu-latest
606- # outputs:
607- # bcl-version: ${{ steps.get-bcl-version-from-git-packages.outputs.latest-bcl-version }}
608- # steps:
609- # - name: Checkout repository
610- # uses: actions/checkout@v3
611-
612-
613- # - name: Get BCL Version from Git Packages
614- # id: get-bcl-version-from-git-packages
615- # run: |
616- # TOKEN="$GITHUB_TOKEN"
617- # OWNER="Phil-NHS"
618- # PACKAGE_NAME="TELBlazorComponentLibrary.GitPageBlazorWasm"
619- # BCL_PACKAGE_PATH="https://api.github.com/users/$OWNER/packages/nuget/$PACKAGE_NAME/versions"
620- # echo "API Path: $BCL_PACKAGE_PATH"
621- # VERSION_JSON=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" $BCL_PACKAGE_PATH)
622- # echo "$VERSION_JSON"
623- # LATEST_VERSION=$(echo "$VERSION_JSON" | jq -r '.[0].name')
624- # echo "latest-bcl-version=$LATEST_VERSION" >> $GITHUB_OUTPUT
625- # - name: Run Semantic Dev Release
626- # id: set-dev-semantic-version
627- # run: |
628- # npx semantic-release
629- # echo "dev-version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
630- # env:
631- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
632-
633- # - name: Debug Git Remote Branches
634- # run: git remote show origin
635- # - name: Check Existing Tags
636- # run: |
637- # echo "Checking existing tags..."
638- # git fetch --tags
639- # git tag -l # List all tags to see if there are any conflicts
640-
641- # - name: Run Semantic Release Dry Run
642- # run: |
643- # echo "Running Semantic Release dry run..."
644- # SEMVER_OUTPUT_DRY=$(npx semantic-release --dry-run)
645- # echo "Dry run output $SEMVER_OUTPUT_DRY"
646-
647- # - name: Get Semantic Version
648- # id: set-dev-semantic-version
649- # env:
650- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
651- # run: |
652- # echo "Running Semantic Release dry run..."
653- # SEMVER_OUTPUT=$(npx semantic-release --dry-run)
654- # echo "Semantic Release Output: $SEMVER_OUTPUT"
655-
656- # # Debug: Check exit code of semantic-release
657- # SEMVER_EXIT_CODE=$?
658- # echo "Semantic Release Exit Code: $SEMVER_EXIT_CODE"
659-
660- # SEMVER_VERSION=$(npx semantic-release --dry-run | grep -oP 'Published release \K[\d.]+')
661-
662- # #SEMVER_VERSION=$(npx semantic-release --dry-run | grep -oP 'Published release \K[\d.]+' || echo "0.1.0")
663-
664- # TIMESTAMP=$(date +"%y%m%d-%H-%M-%S")
665- # BRANCH_NAME=$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's/[^a-zA-Z0-9.-]/_/g')
666- # FULL_VERSION="${SEMVER_VERSION}-DEV-${BRANCH_NAME}-${TIMESTAMP}"
667- # echo "Extracted Version: $FULL_VERSION"
668- # echo "dev-semantic-version=$FULL_VERSION" >> $GITHUB_OUTPUT
0 commit comments