From 70c8f8ef3619bf2c557e19ced471a0888dfe853c Mon Sep 17 00:00:00 2001 From: Taylor Brazelton Date: Thu, 27 Jul 2023 16:21:19 -0700 Subject: [PATCH 1/3] Fix for datetime issue. --- .github/workflows/export-to-branch.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/export-to-branch.yml b/.github/workflows/export-to-branch.yml index 7f66da21..5a315973 100644 --- a/.github/workflows/export-to-branch.yml +++ b/.github/workflows/export-to-branch.yml @@ -10,13 +10,16 @@ on: jobs: export-solution: runs-on: windows-latest - + defaults: + run: + shell: pwsh + steps: - id: date name: Get current datetime run: | $datetime = $(Get-Date -Format "yyyy-MM-ddTHH:mm:ss") - echo "datetime=$datetime" >> "$GITHUB_OUTPUT" + echo "datetime=$datetime" | Out-File $env:GITHUB_ENV -Append -Encoding utf8 - name: Checkout code uses: actions/checkout@v2 From 2555cf8c557f09eb2b1859e57b598306b2442098 Mon Sep 17 00:00:00 2001 From: Taylor Brazelton Date: Thu, 27 Jul 2023 16:27:18 -0700 Subject: [PATCH 2/3] Trial 2 --- .github/workflows/export-to-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export-to-branch.yml b/.github/workflows/export-to-branch.yml index 5a315973..f736bcdc 100644 --- a/.github/workflows/export-to-branch.yml +++ b/.github/workflows/export-to-branch.yml @@ -19,7 +19,7 @@ jobs: name: Get current datetime run: | $datetime = $(Get-Date -Format "yyyy-MM-ddTHH:mm:ss") - echo "datetime=$datetime" | Out-File $env:GITHUB_ENV -Append -Encoding utf8 + echo "datetime=$datetime" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Checkout code uses: actions/checkout@v2 From 23721d9ac91c6acc3427d69d12c9c3d521ec00ee Mon Sep 17 00:00:00 2001 From: Taylor Brazelton Date: Thu, 27 Jul 2023 16:39:37 -0700 Subject: [PATCH 3/3] Updates to fix a few more things... --- .github/workflows/auto-export-and-deploy.yml | 22 ++++++++++---------- .github/workflows/export-to-branch.yml | 6 ++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/auto-export-and-deploy.yml b/.github/workflows/auto-export-and-deploy.yml index 25a776a1..37ddc986 100644 --- a/.github/workflows/auto-export-and-deploy.yml +++ b/.github/workflows/auto-export-and-deploy.yml @@ -36,7 +36,7 @@ jobs: name: Get current datetime run: | $datetime = $(Get-Date -Format "yyyy-MM-ddTHH:mm:ss") - echo "datetime=$datetime" >> "$GITHUB_OUTPUT" + echo "datetime=$datetime" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Setup .NET Core environment uses: actions/setup-dotnet@v1 @@ -64,7 +64,7 @@ jobs: $lines = $output -split "`n" $versionLine = $lines | Where-Object { $_ -match "${{ github.event.inputs.solution_name }}" } $version = ($versionLine -split "\s+")[3] - echo "current_version=$version" >> "$GITHUB_OUTPUT" + echo "current_version=$version" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 # Split the version into its components $versionParts = $version.Split('.') # Define an environment variable for the version part to increment @@ -78,30 +78,30 @@ jobs: } # Reconstruct the version $newVersion = "{0}.{1}.{2}.{3}" -f $versionParts[0], $versionParts[1], $versionParts[2], $versionParts[3] - echo "new_version=$newVersion" >> "$GITHUB_OUTPUT" + echo "new_version=$newVersion" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 $newVersionWithUnderscores = "{0}_{1}_{2}_{3}" -f $versionParts[0], $versionParts[1], $versionParts[2], $versionParts[3] - echo "new_version_with_underscores=$newVersionWithUnderscores" >> "$GITHUB_OUTPUT" + echo "new_version_with_underscores=$newVersionWithUnderscores" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Increment the online version run: pac solution online-version --solution-name "${{ github.event.inputs.solution_name }}" --solution-version ${{ steps.solution_versioning.outputs.new_version }} - name: Export unmanaged solution - run: pac solution export --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_unmanaged.zip" --name "${{ github.event.inputs.solution_name }}" --include general + run: pac solution export --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_unmanaged.zip" --name "${{ github.event.inputs.solution_name }}" --include general - name: Export managed solution - run: pac solution export --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_managed.zip" --name "${{ github.event.inputs.solution_name }}" --managed --include general + run: pac solution export --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed.zip" --name "${{ github.event.inputs.solution_name }}" --managed --include general - name: Publish unmanaged artifact uses: actions/upload-artifact@v2 with: - name: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_unmanaged - path: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_unmanaged.zip + name: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_unmanaged + path: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_unmanaged.zip - name: Publish managed artifact uses: actions/upload-artifact@v2 with: - name: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_managed - path: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_managed.zip + name: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed + path: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed.zip - name: Auth with Source Environment run: | @@ -114,4 +114,4 @@ jobs: - name: Deploy Managed version To Target Environment run: | - pac solution import --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputsnew_version_with_underscores }}_managed.zip" --activate-plugins --publish-changes + pac solution import --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed.zip" --activate-plugins --publish-changes diff --git a/.github/workflows/export-to-branch.yml b/.github/workflows/export-to-branch.yml index f736bcdc..d0a3b384 100644 --- a/.github/workflows/export-to-branch.yml +++ b/.github/workflows/export-to-branch.yml @@ -19,7 +19,9 @@ jobs: name: Get current datetime run: | $datetime = $(Get-Date -Format "yyyy-MM-ddTHH:mm:ss") + $datetimeForBranchName = $datetime -replace ":", "-" echo "datetime=$datetime" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 + echo "datetimeForBranchName=$datetimeForBranchName" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Checkout code uses: actions/checkout@v2 @@ -65,7 +67,7 @@ jobs: run: | git config --global user.name "GitHub Actions" git config --global user.email "github-actions@github.com" - git checkout -b "${{ github.event.inputs.solution_name }}-${{ steps.date.outputs.datetime }}" + git checkout -b "${{ github.event.inputs.solution_name }}-${{ steps.date.outputs.datetimeForBranchName }}" git add . git commit -m "Synced ${{ github.event.inputs.solution_name }} Power Platform Solution" - git push --set-upstream origin "${{ github.event.inputs.solution_name }}-${{ steps.date.outputs.datetime }}" \ No newline at end of file + git push --set-upstream origin "${{ github.event.inputs.solution_name }}-${{ steps.date.outputs.datetimeForBranchName }}" \ No newline at end of file