62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
name: Autodeploy Setup
|
|
description: Copy the `autodeploy` scripts into the caller repository, install prerequisites and run `setup.sh`.
|
|
|
|
inputs:
|
|
branch:
|
|
description: "Branch or ref to check out in the caller repository"
|
|
required: false
|
|
default: "main"
|
|
destination:
|
|
description: "Destination directory for the autodeploy scripts (relative to the repository root)"
|
|
required: true
|
|
commit_message:
|
|
description: "Commit message used when autodeploy changes files"
|
|
required: false
|
|
default: "chore: apply autodeploy updates"
|
|
git_user_name:
|
|
description: "Git author name for automated commits"
|
|
required: false
|
|
default: "gitea-actions-bot"
|
|
git_user_email:
|
|
description: "Git author email for automated commits"
|
|
required: false
|
|
default: "gitea-actions-bot@users.noreply.gitea.psi.ch"
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Checkout caller repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: true
|
|
ref: ${{ inputs.branch }}
|
|
path: tmp
|
|
|
|
- name: Deploy files
|
|
shell: bash
|
|
run: |
|
|
rsync -rlv "$GITHUB_WORKSPACE/tmp/" "${{ inputs.destination }}/"
|
|
|
|
- name: Run setup.sh
|
|
shell: bash
|
|
run: |
|
|
$GITHUB_ACTION_PATH/autodeploy/setup.sh "${{ inputs.destination }}"
|
|
|
|
- name: Commit and push changes
|
|
working-directory: ${{ inputs.destination }}
|
|
shell: bash
|
|
run: |
|
|
git config user.name "${{ inputs.git_user_name }}"
|
|
git config user.email "${{ inputs.git_user_email }}"
|
|
|
|
git add -A
|
|
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit"
|
|
exit 0
|
|
fi
|
|
|
|
git commit -m "${{ inputs.commit_message }}"
|
|
git push origin "HEAD:${{ inputs.branch }}"
|