Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Moving GH Action template syntax to env variables #3484

Merged
merged 1 commit into from Feb 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/actions/deploy-dir-as-branch/action.yml
Expand Up @@ -11,8 +11,10 @@ runs:
- name: Creating temporary directory to clone the branch
shell: bash
run: |
BRANCH_DIR=$(mktemp -d "`pwd`/cloned_${{ inputs.target_branch }}_XXXXXX")
BRANCH_DIR=$(mktemp -d "`pwd`/$BRANCH_DIR_TEMPLATE")
echo "BRANCH_DIR=$BRANCH_DIR" >> $GITHUB_ENV
env:
BRANCH_DIR_TEMPLATE: 'cloned_${{ inputs.target_branch }}_XXXXXX'

- name: Checkout `${{ inputs.target_branch }}` branch
uses: actions/checkout@v2
Expand All @@ -31,7 +33,7 @@ runs:
echo '::endgroup::'

echo '::group::Move necessary files'
cp -vnR '${{ github.workspace }}/${{ inputs.src_dir }}/.' .
cp -vnR "$SRC_DIR/." .
echo '::endgroup::'

git add -A
Expand All @@ -41,12 +43,16 @@ runs:
git config user.name 'GitHub Action Script'
git config user.email 'please@open.issue'

git commit -a -m 'Deploy ${{ github.sha }} to '${{ inputs.target_branch }}' branch'
git commit -a -m "Deploy $SHA to '$TARGET_BRANCH' branch"
git push
echo 'Pushed'
fi
env:
SRC_DIR: '${{ github.workspace }}/${{ inputs.src_dir }}'
SHA: ${{ github.sha }}
TARGET_BRANCH: ${{ inputs.target_branch }}

- name: Remove cloned branch
if: ${{ always() }}
shell: bash
run: 'rm -rf $BRANCH_DIR'
run: 'rm -rf "$BRANCH_DIR"'