From 3d1806e7757f1e7f56a2cb52adad2a1f15df36de Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 16 Jan 2022 15:45:16 +0000 Subject: [PATCH] Deploy from alternative branches (#248) * Try setting branch dynamically * Just use the github_ref variable * Some debug steps * Why does git asteriks my output? * Try env variable directly * Use github context * Remove the ref/head/ part from the branch name * Set branch in env variable * Try and fix env redirect * Use/set correct env name --- .github/workflows/deploy.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 78c95b43..e383a61c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -21,6 +21,12 @@ jobs: - name: 🌎 Set Environment Variables Part 2 run: | echo "newReleaseDir=${{ env.releasesDir }}/${{ env.newReleaseName }}" >> $GITHUB_ENV + - name: 🔀 Get Branch + id: branch + run: | + echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + - name: 🔍 Check Branch + run: echo "${{ env.branch }}" - name: 🔄 Clone Repository uses: appleboy/ssh-action@master with: @@ -39,7 +45,7 @@ jobs: mkdir ${{ env.newReleaseDir }} # Clone app - git clone --depth 1 --branch main https://github.com/${{ env.repository }} ${{ env.newReleaseName }} + git clone --depth 1 --branch ${{ env.branch }} https://github.com/${{ env.repository }} ${{ env.newReleaseName }} # Mark release cd ${{ env.newReleaseDir }}