-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh/actions: refactor out action to deploy branches (#3433)
- Loading branch information
1 parent
3ab82f4
commit 71dd289
Showing
6 changed files
with
60 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ | |
/coverage | ||
/npmDist | ||
/denoDist | ||
/npm | ||
/deno | ||
|
||
# Ignore TS files inside integration test | ||
/integrationTests/ts/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: 'Deploy specified directory as a branch' | ||
description: 'This action deploys directory as branch.' | ||
inputs: | ||
src_dir: | ||
required: true | ||
target_branch: | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Creating temporary directory to clone the branch | ||
shell: bash | ||
run: | | ||
BRANCH_DIR=$(mktemp -d "`pwd`/cloned_${{ inputs.target_branch }}_XXXXXX") | ||
echo "BRANCH_DIR=$BRANCH_DIR" >> $GITHUB_ENV | ||
- name: Checkout `${{ inputs.target_branch }}` branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ inputs.target_branch }} | ||
path: ${{ env.BRANCH_DIR }} | ||
|
||
- name: Publish `${{ inputs.target_branch }}` branch | ||
working-directory: ${{ env.BRANCH_DIR }} | ||
shell: bash | ||
run: | | ||
echo '::echo::on' | ||
echo '::group::Remove existing files first' | ||
git rm -r . | ||
echo '::endgroup::' | ||
echo '::group::Move necessary files' | ||
cp -vnR '${{ github.workspace }}/${{ inputs.src_dir }}/.' . | ||
echo '::endgroup::' | ||
git add -A | ||
if git diff --staged --quiet; then | ||
echo 'Nothing to publish' | ||
else | ||
git config user.name 'GitHub Action Script' | ||
git config user.email '[email protected]' | ||
git commit -a -m 'Deploy ${{ github.sha }} to '${{ inputs.target_branch }}' branch' | ||
git push | ||
echo 'Pushed' | ||
fi | ||
- name: Remove cloned branch | ||
if: ${{ always() }} | ||
shell: bash | ||
run: 'rm -rf $BRANCH_DIR' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,3 @@ | |
/coverage | ||
/npmDist | ||
/denoDist | ||
/npm | ||
/deno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,3 @@ | |
/coverage | ||
/npmDist | ||
/denoDist | ||
/npm | ||
/deno |
This file was deleted.
Oops, something went wrong.