Skip to content

Commit

Permalink
Merge pull request #22 from peckadesign/p7packages-composer
Browse files Browse the repository at this point in the history
P7packages composer
  • Loading branch information
AloisJasa authored Apr 1, 2024
2 parents e6f5bc1 + 9c30710 commit a9df14b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/actions/split-monorepo/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: 'Force push'
required: false
default: 'false'
push-tags:
description: 'Push tags'
required: false
default: 'false'
gh-token:
required: true
description: "GitHub token"
Expand All @@ -28,4 +32,4 @@ runs:
shell: "bash"
run: |
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
bash ${{github.action_path}}/split-repositories.sh "${{ inputs.gh-token }}" "${{ inputs.package }}" ${{ inputs.organization }} "${{ github.ref_name }}" ${{ inputs.force == 'true' }}
bash ${{github.action_path}}/split-repositories.sh "${{ inputs.gh-token }}" "${{ inputs.package }}" ${{ inputs.organization }} "${{ github.ref_name }}" ${{ inputs.force == 'true' }} ${{ inputs.push-tags == 'true' }}
9 changes: 6 additions & 3 deletions .github/actions/split-monorepo/split-repositories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PACKAGE=$2
ORGANIZATION=$3
BRANCH=$4
FORCE=${5:-false}
PUSH_TAG=${6:-false}

TMP="tmp_split/${RANDOM}"
URL="https://${GH_TOKEN}@github.com/${ORGANIZATION}/${PACKAGE}"
Expand All @@ -19,10 +20,12 @@ echo "Monorepo Split – ${PACKAGE}"

echo "Init environment"

PUSH_OPTS=""
if [[ "$FORCE" == true ]]; then
PUSH_OPTS="--force"
else
PUSH_OPTS="--tags"
PUSH_OPTS="${PUSH_OPTS} --force"
fi
if [[ "$PUSH_TAG" == true ]]; then
PUSH_OPTS="${PUSH_OPTS} --tags"
fi

cd ${DIR_PWD}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/composer-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ jobs:
- name: Composer validate
if: env.GIT_DIFF && env.MATCHED_FILES
run: |
composer install --no-progress
composer validate
15 changes: 14 additions & 1 deletion .github/workflows/monorepo_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Monorepo release
run-name: Monorepo release - ${{ inputs.version }} version

on:
workflow_dispatch:
Expand Down Expand Up @@ -55,5 +56,17 @@ jobs:
- name: Composer
uses: ramsey/composer-install@v2

- name: Stage Check
id: stage
shell: bash
run: |
if [ "${{ inputs.version }}" == 'patch' ]; then
echo "stage=patch" >> $GITHUB_OUTPUT;
elif [ "${{ inputs.version }}" == 'minor' ]; then
echo "stage=release" >> $GITHUB_OUTPUT;
elif [ "${{ inputs.version }}" == 'major' ]; then
echo "stage=release" >> $GITHUB_OUTPUT;
fi
- name: Release
run: vendor/bin/monorepo-builder release ${{ inputs.version }}
run: vendor/bin/monorepo-builder release ${{ inputs.version }} --stage ${{ steps.stage.outputs.stage}}
6 changes: 6 additions & 0 deletions .github/workflows/split_monorepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
required: false
type: boolean
default: false
push-tags:
description: 'push tags'
required: false
type: boolean
default: false
secrets:
gh-token:
required: true
Expand Down Expand Up @@ -64,4 +69,5 @@ jobs:
organization: ${{ inputs.organization }}
package: ${{ inputs.package }}
force: ${{ inputs.force }}
push-tags: ${{ inputs.push-tags }}
gh-token: ${{ secrets.gh-token }}
1 change: 1 addition & 0 deletions workflow-templates/p7-monorepo-split-with-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ jobs:
package: ${{ matrix.package }}
organization: "peckadesign"
force: ${{ inputs.force == 'true' }}
push-tags: ${{ github.ref != 'refs/heads/master' }}
secrets:
gh-token: # GITHUB Token
1 change: 1 addition & 0 deletions workflow-templates/p7-monorepo-split.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ jobs:
with:
package: ${{ matrix.package }}
organization: "peckadesign"
push-tags: ${{ github.ref != 'refs/heads/master' }}
secrets:
gh-token: # GITHUB Token

0 comments on commit a9df14b

Please sign in to comment.