Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/sync-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ jobs:
if: steps.decide.outputs.sync == 'true'
run: |
yq -r '.copy[]' target/.github/sync.yaml | while IFS= read -r file; do
source_file="source/$file"
target_file="target/$file"
mkdir -p "$(dirname "$target_file")"
cp "$source_file" "$target_file"
if [[ "$file" == *:* ]]; then
IFS=':' read -r source_file destination_file <<< "$file"
else
source_file="$file"
destination_file="$file"
fi
source_path="source/$source_file"
destination_path="target/$destination_file"
mkdir -p "$(dirname "$destination_path")"
cp "$source_path" "$destination_path"
done

- name: Detect sync updates
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
```

> [!note]
> To use GitHub App instead of GitHub token pass`inputs.GH_APP_ID` and `secrets.GH_APP_PEM_FILE` instead of `secrets.GITHUB_TOKEN`.
> To use GitHub App instead of GitHub token pass`inputs.GH_APP_ID` and `secrets.GH_APP_PEM_FILE` instead of `secrets.GITHUB_TOKEN`. See [`examples/workflows/semantic-release.yaml`](examples/workflows/semantic-release.yaml).

Configure in a repository, for example, `.releaserc.yaml`:

Expand Down Expand Up @@ -100,13 +100,14 @@ plugins:
Configure target repositories:

- Target repositories are specified at the source repository [Sync Files Workflow](.github/workflows/sync-files.yaml) in the matrix.
- Files to sync are specified in the target repository file `.github/sync.yaml`:
- Files to sync are specified in the target repository file `.github/sync.yaml`.
- `copy` section contains an array of files to copy, either in `source/file` or `source/file:destination/file` form. Destination subdirectories are created when necessary.

```yaml
---
copy:
- .github/workflows/semantic-release.yaml
- .releaserc.yaml
- examples/workflows/semantic-release.yaml:.github/workflows/semantic-release.yaml
- .releaserc.yaml
```

## Credits and Acknowledgments
Expand Down
16 changes: 16 additions & 0 deletions examples/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Semantic Release

on:
push:
branches:
- main

jobs:
release:
name: Release
uses: xebis/github-actions-and-workflows/.github/workflows/semantic-release.yaml@v0
with:
GH_APP_ID: ${{ vars.GH_APP_SEM_REL_ID }}
secrets:
GH_APP_PEM_FILE: ${{ secrets.GH_APP_SEM_REL_PEM_FILE }}