Skip to content

Commit

Permalink
Merge pull request #130 from rees46/fix/composite-action
Browse files Browse the repository at this point in the history
fix: composite action
  • Loading branch information
Nelfimov authored Apr 26, 2024
2 parents a660bdd + 2decc10 commit 42a8c81
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/composite-base-commit-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ name: Version composite action
description: patch versions of changed packages

inputs:
private:
description: Should apply only to private?
required: false
default: 'false'
checkChanges:
description: Should run 'yarn --since'?
required: false
default: 'true'
token:
description: GitHub PAT
required: true
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/composite-commit-js.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Commit changes composite
description: commit made changes

inputs:
token:
description: GitHub PAT
required: true
baseCommit:
description: Base commit to check changes from
required: true

runs:
using: composite

steps:
- name: GitSign
uses: chainguard-dev/actions/setup-gitsign@main
shell: bash

- name: Create commit message
id: commit_message
env:
BASE_COMMIT: ${{ inputs.baseCommit }}
run: |
INITIAL_MESSAGE=$'chore(common): versions\n\n'
temp_file=$(mktemp)
yarn workspaces foreach --since=$BASE_COMMIT exec "echo \"\$npm_package_name:\$npm_package_version \" >> $temp_file"
MESSAGE=$(cat $temp_file)
echo $(cat $temp_file)
INITIAL_MESSAGE+=$MESSAGE
INITIAL_MESSAGE="${INITIAL_MESSAGE//'%'/' '}"
INITIAL_MESSAGE="${INITIAL_MESSAGE//$'\n'/' '}"
INITIAL_MESSAGE="${INITIAL_MESSAGE//$'\r'/' '}"
echo "commitMessage=$INITIAL_MESSAGE" >> $GITHUB_OUTPUT
echo $INITIAL_MESSAGE
rm $temp_file
shell: bash

- name: Commit changes
id: committer
uses: EndBug/add-and-commit@v9
env:
GITHUB_TOKEN: ${{ inputs.token }}
with:
commit: -S
default_author: github_actions
author_email: github-bot@rees46.com
message: ${{ steps.commit_message.outputs.commitMessage }}
add: '["*.lock", "*.json", "*.yml", "*.md"]'
shell: bash
4 changes: 2 additions & 2 deletions .github/workflows/composite-release-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ runs:
if: inputs.isMonorepo == 'true'
env:
BASE_COMMIT: ${{ inputs.baseCommit }}
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
GH_TOKEN: ${{ inputs.token }}
run: yarn workspaces foreach --since=$BASE_COMMIT^ exec 'bash -c "yarn pack && VERSION=$npm_package_version && NAME=$npm_package_name && gh release create \"\$NAME-v\$VERSION\" ./package.tgz --title=\$NAME-\$VERSION --notes-file=./CHANGELOG.md"'
shell: bash

- name: Release single package
if: inputs.isMonorepo == 'false'
env:
BASE_COMMIT: ${{ inputs.baseCommit }}
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
GH_TOKEN: ${{ inputs.token }}
run: yarn workspaces foreach --since=$BASE_COMMIT^ exec 'bash -c "yarn pack && VERSION=$npm_package_version && gh release create \"v\$VERSION\" ./package.tgz --title=\$VERSION --notes-file=./CHANGELOG.md"'
shell: bash

0 comments on commit 42a8c81

Please sign in to comment.