Fixed potential issues with types of conclusion for SignIn or Sign wi… #223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET Build and Upload Artifacts | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Debug Environment Variables | |
run: echo "GITHUB_SHA=$GITHUB_SHA" | |
- name: Build with MSBuild | |
run: dotnet build --configuration Release --no-restore | |
- name: Extract version from manifest.json | |
id: extract_version | |
run: | | |
manifest_path="KeriAuth.BrowserExtension/wwwroot/manifest.json" | |
if [[ -f "$manifest_path" ]]; then | |
version=$(jq -r '.version' "$manifest_path") | |
echo "version=$version" >> $GITHUB_ENV | |
echo "Version extracted from manifest.json: $version" | |
else | |
echo "Error: manifest.json not found at $manifest_path" | |
exit 1 | |
fi | |
- name: Set short commit hash | |
run: | | |
SHORT_COMMIT_HASH=$(echo "$GITHUB_SHA" | cut -c1-7) | |
echo "SHORT_COMMIT_HASH=$SHORT_COMMIT_HASH" >> $GITHUB_ENV | |
echo "Short Commit Hash: ${{ env.SHORT_COMMIT_HASH }}" | |
CURRENT_DATETIME=$(date -u +"%Y-%m-%d") | |
echo "CURRENT_DATETIME=$CURRENT_DATETIME" >> $GITHUB_ENV | |
echo "Current Date-Time: $CURRENT_DATETIME" | |
- name: Modify version_name in manifest.json | |
run: | | |
new_version_name="${{ env.version }} ${{ env.SHORT_COMMIT_HASH }} ${{ env.CURRENT_DATETIME }}" | |
echo "New Version Name: $new_version_name" | |
for file in \ | |
KeriAuth.BrowserExtension/bin/Release/net8.0/wwwroot/manifest.json \ | |
KeriAuth.BrowserExtension/bin/Release/net8.0/browserextension/manifest.json; do | |
if [[ -f "$file" ]]; then | |
jq --arg new_version_name "$new_version_name" \ | |
'.version_name = $new_version_name' "$file" > temp.json | |
mv temp.json "$file" | |
echo "Updated $file with version_name: $new_version_name" | |
else | |
echo "Warning: File $file not found, skipping..." | |
fi | |
done | |
- name: Display modified version_name | |
run: | | |
for file in \ | |
KeriAuth.BrowserExtension/bin/Release/net8.0/wwwroot/manifest.json \ | |
KeriAuth.BrowserExtension/bin/Release/net8.0/browserextension/manifest.json; do | |
if [[ -f "$file" ]]; then | |
echo "Contents of $file:" | |
cat "$file" | |
else | |
echo "Warning: File $file not found, skipping..." | |
fi | |
done | |
- name: Run tests | |
run: dotnet test --configuration Release --no-build --verbosity normal | |
- name: Zip artifacts | |
run: | | |
build_dir="$GITHUB_WORKSPACE/KeriAuth.BrowserExtension/bin/Release/net8.0/browserextension/" | |
artifact_suffix="${{ env.version }}" | |
# "-${{ env.SHORT_COMMIT_HASH }}-$(date -u +"%Y-%m-%d")" | |
artifact_path="$GITHUB_WORKSPACE/KeriAuth.zip" | |
# "-${artifact_suffix}.zip" | |
if [[ -d "$build_dir" ]]; then | |
cd "$build_dir" | |
zip -r "$artifact_path" * | |
echo "Artifacts zipped to $artifact_path" | |
else | |
echo "Error: Build directory $build_dir not found" | |
exit 1 | |
fi | |
echo "ARTIFACT_PATH=$artifact_path" >> $GITHUB_ENV | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: ${{ env.ARTIFACT_PATH }} |