Skip to content

Commit

Permalink
Merge pull request #27 from microsoft/revert-25-revert-24-users/ryanb…
Browse files Browse the repository at this point in the history
…58/github-actions-fix-deprecated-feature

Revert 25 revert 24 users/ryanb58/GitHub actions fix deprecated feature
  • Loading branch information
Ryanb58 committed Jul 27, 2023
2 parents cc61c0b + 23721d9 commit 7ad50c0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/auto-export-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
13 changes: 9 additions & 4 deletions .github/workflows/export-to-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ 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"
$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
Expand Down Expand Up @@ -62,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 }}"
git push --set-upstream origin "${{ github.event.inputs.solution_name }}-${{ steps.date.outputs.datetimeForBranchName }}"

0 comments on commit 7ad50c0

Please sign in to comment.