diff --git a/.github/workflows/sync-files.yaml b/.github/workflows/sync-files.yaml index e4757c3..3b962b9 100644 --- a/.github/workflows/sync-files.yaml +++ b/.github/workflows/sync-files.yaml @@ -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 diff --git a/README.md b/README.md index 70cfdc9..9f3fa40 100644 --- a/README.md +++ b/README.md @@ -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`: @@ -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 diff --git a/examples/workflows/semantic-release.yaml b/examples/workflows/semantic-release.yaml new file mode 100644 index 0000000..89f4d53 --- /dev/null +++ b/examples/workflows/semantic-release.yaml @@ -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 }}