From 72fb11b79045fd0d8f7350f52bf26ca205f4ad88 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 17 Mar 2020 18:11:23 -0600 Subject: [PATCH 1/6] adds copying build output and pushing to builds repo --- .github/workflows/docker.yml | 66 +++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 00f75d0..18e0d15 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -97,7 +97,6 @@ jobs: uses: actions/download-artifact@v1 with: name: Build - path: ./build.zip - name: Download Version Info uses: actions/download-artifact@v1 with: @@ -107,12 +106,25 @@ jobs: - name: Set Version Number shell: powershell run: | - Get-ChildItem "./Version" - $version = Get-Content -Path ./Version/version.txt - Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" - Remove-Item -Path ./Version/version.txt - Remove-Item -Path ./Version + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + - name: Copy build output and push + run: | + $branch = $(${{ env.GITHUB_REF }}) -Replace "refs/heads/"; + git checkout -b $branch + Get-ChildItem -Path "./Build" | Copy-Item -Path ./ + Remove-Item -Path ./Build -Recurse + git add . + git commit -m "Build ${{ env.GITHUB_RUN_NUMBER }} from commit: https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }}" + git tag ${{ env.VERSION }} + git push --set-upstream origin +$branch --force + git push --tags origin + + # "Build #${SOURCE_BUILD_NUMBER} from commit: https://github.com/PepperDash/PepperDashCore/commit/${COMMIT}" - name: Check Directory run: | Get-ChildItem "./" @@ -127,23 +139,23 @@ jobs: # path: ./internal_builds_repo # repository: PepperDash-Engineering/pepperdash-core-builds # - name: Download Build output - # uses: actions/download-artifact@v1 - # with: - # name: Build - # path: ./build.zip - # - name: Download Version Info - # uses: actions/download-artifact@v1 - # with: - # name: Version - # - name: Check Directory - # run: Get-ChildItem "./" - # - name: Set Version Number - # shell: powershell - # run: | - # Get-ChildItem "./" - # $version = Get-Content -Path ./version.txt - # Write-Output "::set-env name=VERSION::$version" - # Remove-Item -Path ./version.txt - # - name: Check Directory - # run: | - # Get-ChildItem "./" + # uses: actions/download-artifact@v1 + # with: + # name: Build + # path: ./build.zip + # - name: Download Version Info + # uses: actions/download-artifact@v1 + # with: + # name: Version + # - name: Check Directory + # run: Get-ChildItem "./" + # - name: Set Version Number + # shell: powershell + # run: | + # Get-ChildItem "./" + # $version = Get-Content -Path ./version.txt + # Write-Output "::set-env name=VERSION::$version" + # Remove-Item -Path ./version.txt + # - name: Check Directory + # run: | + # Get-ChildItem "./" From d9e243c30d4c9f3212c5a6e347d544c2f36017ba Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 17 Mar 2020 18:20:51 -0600 Subject: [PATCH 2/6] adds $() for branch name and fixes env for getting ref --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 18e0d15..d5a50ed 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -115,7 +115,7 @@ jobs: - name: Copy build output and push run: | $branch = $(${{ env.GITHUB_REF }}) -Replace "refs/heads/"; - git checkout -b $branch + git checkout -b $($branch) Get-ChildItem -Path "./Build" | Copy-Item -Path ./ Remove-Item -Path ./Build -Recurse git add . From 8474c5c7b7075cee45693c87aefa45a9b637a2d5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 17 Mar 2020 18:29:23 -0600 Subject: [PATCH 3/6] Removes variable for branch name --- .github/workflows/docker.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d5a50ed..e442a45 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -114,8 +114,7 @@ jobs: Remove-Item -Path ./Version - name: Copy build output and push run: | - $branch = $(${{ env.GITHUB_REF }}) -Replace "refs/heads/"; - git checkout -b $($branch) + git checkout -b $($Env:GITHUB_REF -Replace "refs/heads/") Get-ChildItem -Path "./Build" | Copy-Item -Path ./ Remove-Item -Path ./Build -Recurse git add . From 8f40629e651608534ea06109028e723e98f92c36 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 17 Mar 2020 18:39:59 -0600 Subject: [PATCH 4/6] fixes pushing branch to origin --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e442a45..7732cce 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -120,7 +120,7 @@ jobs: git add . git commit -m "Build ${{ env.GITHUB_RUN_NUMBER }} from commit: https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }}" git tag ${{ env.VERSION }} - git push --set-upstream origin +$branch --force + git push --set-upstream origin $($Env:GITHUB_REF -Replace "refs/heads/") --force git push --tags origin # "Build #${SOURCE_BUILD_NUMBER} from commit: https://github.com/PepperDash/PepperDashCore/commit/${COMMIT}" From 4cfd51f76ef2d05238b20a3b46d831dc75b69935 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 17 Mar 2020 18:48:34 -0600 Subject: [PATCH 5/6] adds -Recurse for copying from Build directory --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7732cce..258a356 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -115,7 +115,7 @@ jobs: - name: Copy build output and push run: | git checkout -b $($Env:GITHUB_REF -Replace "refs/heads/") - Get-ChildItem -Path "./Build" | Copy-Item -Path ./ + Get-ChildItem -Path "./Build" -Recurse | Copy-Item -Path ./ Remove-Item -Path ./Build -Recurse git add . git commit -m "Build ${{ env.GITHUB_RUN_NUMBER }} from commit: https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }}" From 2632dccbec467499693ca39608d30679d82e8f8e Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 17 Mar 2020 18:58:51 -0600 Subject: [PATCH 6/6] switches up the order of some operations --- .github/workflows/docker.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 258a356..a6fb477 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -93,10 +93,6 @@ jobs: with: token: ${{ secrets.BUILDS_TOKEN }} repository: PepperDash-Engineering/pepperdash-core-builds - - name: Download Build output - uses: actions/download-artifact@v1 - with: - name: Build - name: Download Version Info uses: actions/download-artifact@v1 with: @@ -112,11 +108,15 @@ jobs: Write-Output "::set-env name=VERSION::$version" Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version + - name: Create new branch + run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ - name: Copy build output and push run: | - git checkout -b $($Env:GITHUB_REF -Replace "refs/heads/") - Get-ChildItem -Path "./Build" -Recurse | Copy-Item -Path ./ - Remove-Item -Path ./Build -Recurse git add . git commit -m "Build ${{ env.GITHUB_RUN_NUMBER }} from commit: https://github.com/${{ env.GITHUB_REPOSITORY }}/commit/${{ env.GITHUB_SHA }}" git tag ${{ env.VERSION }}