Prepare release #23
This file contains hidden or 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
name: Prepare release | |
on: | |
workflow_dispatch: | |
inputs: | |
repos_to_release: | |
description: "Manual list of repositories to release (.github/config/repos-to-release.txt content if left empty)" | |
default: "" | |
required: false | |
target_date: | |
description: "Date of last commit to inlude (ISO 8601, ex: 2024-09-13T23:59:59Z - default : last friday 23:59:59)." | |
required: false | |
release-version: | |
description: "Version for new tag (ex: v2.8.0)" | |
required: true | |
secrets: | |
VERSIONBUMP_GHAPP_PRIVATE_KEY: | |
required: true | |
jobs: | |
prepare-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout aggregator repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
ref: release-workflow | |
- uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1 v1.11.6 | |
id: app-token | |
name: Generate app token | |
with: | |
app-id: ${{ vars.GRIDSUITE_ACTIONS_APPID }} | |
private-key: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: | | |
echo $(gh api "/users/${RUNGHA_APP_SLUG}[bot]") | |
echo "user-id=$(gh api "/users/${RUNGHA_APP_SLUG}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
RUNGHA_APP_SLUG: ${{ steps.app-token.outputs.app-slug }} # just for defense against script injection | |
- name: Setup git user | |
run: | | |
git config --global user.name "${RUNGHA_APP_SLUG}[bot]" | |
git config --global user.email "${RUNGHA_USER_ID}+${RUNGHA_APP_SLUG}[bot]@users.noreply.github.com" | |
env: | |
RUNGHA_APP_SLUG: ${{ steps.app-token.outputs.app-slug }} # just for defense against script injection | |
RUNGHA_USER_ID: ${{ steps.get-user-id.outputs.user-id }} # just for defense against script injection | |
- name: Push branch to ci-cd-test | |
run: | | |
TOKEN=${{ steps.app-token.outputs.token }} | |
REPO=gridsuite/ci-cd-test | |
BRANCH=test-branch | |
echo "Cloning $REPO" | |
git clone --depth 1 https://x-access-token:[email protected]/$REPO.git | |
cd ci-cd-test | |
echo "File updated from central workflow at $(date)" > central-update.txt | |
git checkout -b $BRANCH | |
git add central-update.txt | |
git commit -m "Central workflow test push" | |
git push origin $BRANCH |