synapsecns / sanguine

Synapse Monorepo
MIT License
43 stars 31 forks source link

Action Publishing #806

Open trajan0x opened 1 year ago

trajan0x commented 1 year ago

Publish actions (composite and contrib) from monorepo into new repos automaitcally so they can be used by other repos

greptile-apps[bot] commented 5 months ago
  1. Create a new workflow in .github/workflows to detect changes in action directories.
  2. Use contrib/git-changes-action to detect changes in .github/actions.
  3. Add steps to push changes to new repositories.

Example workflow:

name: Publish Actions

on:
  push:
    paths:
      - '.github/actions/**'

jobs:
  detect-and-publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Detect Changes
        uses: ./contrib/git-changes-action
        id: changes

      - name: Publish Add-Label Action
        if: contains(steps.changes.outputs.changed_modules, '.github/actions/add-label')
        run: |
          git clone https://github.com/your-org/add-label-action.git
          cp -r .github/actions/add-label/* add-label-action/
          cd add-label-action
          git add .
          git commit -m 'Update add-label action'
          git push

      - name: Publish Remove-Label Action
        if: contains(steps.changes.outputs.changed_modules, '.github/actions/remove-label')
        run: |
          git clone https://github.com/your-org/remove-label-action.git
          cp -r .github/actions/remove-label/* remove-label-action/
          cd remove-label-action
          git add .
          git commit -m 'Update remove-label action'
          git push

      - name: Publish Setup-NodeJS Action
        if: contains(steps.changes.outputs.changed_modules, '.github/actions/setup-nodejs')
        run: |
          git clone https://github.com/your-org/setup-nodejs-action.git
          cp -r .github/actions/setup-nodejs/* setup-nodejs-action/
          cd setup-nodejs-action
          git add .
          git commit -m 'Update setup-nodejs action'
          git push

References

/.github/actions /.github/workflows /contrib/git-changes-action

Ask Greptile