Skip to content

update

update #392

# This is a basic workflow to help you get started with Actions
name: Update Submodules
on:
repository_dispatch:
types: update
workflow_dispatch:
inputs:
branch:
description: 'Define branch name (use production for production module)'
required: true
default: 'main'
module:
description: 'Define module name'
required: true
default: 'main'
type: 'choice'
options:
- main
- production
- weld
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Clone
run: |
git clone --recurse-submodules https://github.com/${{ github.repository }} DevOps
# Update references
- name: Git Sumbodule Update
env:
BRANCH: ${{github.event.client_payload.branch || github.event.inputs.branch}}
MODULE: ${{github.event.client_payload.module || github.event.inputs.module}}
run: |
cd DevOps/$MODULE
git pull origin $BRANCH
- name: Commit update
env:
BRANCH: ${{github.event.client_payload.module || github.event.inputs.module}}
run: |
cd DevOps
git config --global user.name 'Git bot'
git config --global user.email 'bot@noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "deploy: $MODULE - Auto updated submodule references" && git push || echo "No changes to commit"
- name: Deploy
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: Smithed-MC/DevOps
event-type: deploy