Skip to content

Commit

Permalink
Git workflows to update submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz committed Dec 5, 2023
1 parent 311ceb0 commit a3cedf0
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cut_release_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cut Release Branch
on:
workflow_dispatch:
inputs:
release-branch:
description: MapStore branch name to use (YYYY.MM.xx). E.g. 2024.01.xx
required: true
main-branch:
description: main branch
default: master
jobs:
cut-release:
name: Create release branch and PRs into main main branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.main-branch }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release branch and generate PR body
id: create-branch
env:
RELEASE_BRANCH: ${{ github.event.inputs.release-branch }}

run: |
# script will go here
echo "Initializing git"
# Optional
git config user.name github-actions
git config user.email [email protected]
BRANCH_NAME="${RELEASE_BRANCH}"
echo "creating branch is $BRANCH_NAME"
git checkout -b "$BRANCH_NAME"
git submodule set-branch --branch $BRANCH_NAME MapStore2
git add .gitmodules
git commit -m "Set branch for submodule MapStore2 to $BRANCH_NAME"
git push --set-upstream origin "$BRANCH_NAME"
33 changes: 33 additions & 0 deletions .github/workflows/submodules_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

name: Update Submodules
on:
schedule:
# run daily at midnight
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Uses the private access token from above link
with:
token: ${{ secrets.GITHUB_TOKEN }}

# Initialize or update each one recursively
- name: Pull & update submodules recursively
run: |
git submodule update --init --recursive
git submodule update --recursive --remote
# Commit to the repo under the GitHub actions user to ensure we have
# reasonable logging to trace back
- name: Commit & push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions - update submodules"
git commit -am "Update submodules" || echo "No changes to commit"
git push

0 comments on commit a3cedf0

Please sign in to comment.