Skip to content

new fix

new fix #9

name: Trigger Multi-Repo Release
on:
push:
branches:
- test-multi-repo-release
env:
RELEASE_VERSION: "v3.1"
COMMIT_DATE: "2024-10-18 00:00:00"
WORKFLOW_FILE: "release.yml"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository for release
uses: actions/checkout@v2
- name: Trigger Release Workflows
id: trigger_release
run: |
repos=(
"gridsuite/spreadsheet-config-server"
"powsybl/powsybl-single-line-diagram-server"
)
for repo in "${repos[@]}"; do
echo "Fetching commits for ${repo}"
# Create a temporary directory
mkdir temp_repo
cd temp_repo
# Shallow fetch to get commits before the specified date
git init
git remote add origin https://github.com/${repo}.git
git fetch --shallow-since="${COMMIT_DATE}" origin main
# Get the latest commit SHA
COMMIT_SHA=$(git rev-parse FETCH_HEAD)
if [ -z "$COMMIT_SHA" ]; then
echo "No commit found before specified date in ${repo}"
exit 1
fi
echo "Triggering release for ${repo} with commit SHA: ${COMMIT_SHA}"
# Uncomment the following to enable release dispatch:
# owner=$(echo $repo | cut -d'/' -f1)
# repo_name=$(echo $repo | cut -d'/' -f2)
# await github.rest.actions.createWorkflowDispatch({
# owner,
# repo: repo_name,
# workflow_id: process.env.WORKFLOW_FILE,
# ref: 'main',
# inputs: {
# releaseVersion: process.env.RELEASE_VERSION,
# gitReference: COMMIT_SHA
# }
# });
cd ..
rm -rf temp_repo
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}