diff --git a/.github/workflows/build_binaries.yml b/.github/workflows/build_binaries.yml index f9d7ce4..1e84755 100644 --- a/.github/workflows/build_binaries.yml +++ b/.github/workflows/build_binaries.yml @@ -2,7 +2,9 @@ name: Build and Commit Binaries on: push: - branches: [master] + branches: [ master ] + paths-ignore: # Prevents the workflow from running on binaries changes. + - 'bin/**' concurrency: group: building @@ -11,14 +13,28 @@ concurrency: jobs: build: - # Prevents the workflow from running on non-human triggers. - if: github.actor != 'github-actions[bot]' runs-on: ubuntu-latest timeout-minutes: 10 steps: + + # Initializes an SSH agent and loads the Deploy Key. + # All subsequent git operations (fetch/push) are authenticated via SSH. + # + # This step uses Deploy Key to bypass the master branch protection rule, + # which allows to push changes to the master branch only via pull request. + # + - name: Setup SSH + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.WORKFLOW_DEPLOY_KEY }} + + # Checkout the repository via SSH Deploy Key. - name: Checkout Repository uses: actions/checkout@v4 + with: + ssh-key: ${{ secrets.WORKFLOW_DEPLOY_KEY }} + persist-credentials: false - name: Set Up Go Environment uses: actions/setup-go@v5 diff --git a/README.md b/README.md index 20e8dfc..a0f0793 100644 --- a/README.md +++ b/README.md @@ -170,4 +170,17 @@ GOOS=windows GOARCH=amd64 go build -trimpath -o bin/embed-code-windows.exe main. GOOS=linux GOARCH=amd64 go build -trimpath -o bin/embed-code-linux main.go ``` +## Development Notes + +This repository is configured with the following GitHub workflows: +- `check` — runs tests across different platforms. +- `build_binaries` — builds binaries on push to the `master` branch. + > Note: This workflow uses a **Deploy Key** instead of the default GitHub Actions bot + > to bypass the `master` branch protection against direct pushes. + > + > If it is necessary to update the Deploy Key, follow these steps: + > 1. Generate an SSH key pair for GitHub: `ssh -i ~/.ssh/workflow_deploy_key -T git@github.com`. + > 2. Add the public key (`workflow_deploy_key.pub`) as a **Deploy Key** in GitHub with write access. + > 3. Add the private key (`workflow_deploy_key`) as a repository secret named `WORKFLOW_DEPLOY_KEY`. + [embed-code-jekyll]: https://github.com/SpineEventEngine/embed-code