Skip to content

Conversation

@nickytonline
Copy link
Contributor

@nickytonline nickytonline commented Aug 30, 2022

Thanks for contributing the Netlify plugins directory!

Are you adding a plugin or updating one?

No plugin is being added or updated. A GitHub action has been added that will synchronize plugins from the repository to our CMS for the Integrations Hub.

  • Adding a plugin
  • Updating a plugin
  • Updating the CI/CD pipeline

Have you completed the following?

Related documents and issues

https://github.com/netlify/pod-ecosystem-frameworks/issues/223

Test plan

Please add a link to a successful public deploy log using the stated version of the plugin. Include any other context reviewers might need for testing.

Currently the new GitHub action will only run when the branch associated with this PR is changed. This is expected for the time being while things are being tested.

  1. Checkout this pull request, e.g. via the GitHub CLI, gh co 820
  2. Run npm install to ensure you have the new packages added in this PR.
  3. Create a .env file (it's in the gitignore 😅 ), and add the following keys:
SANITY_API_TOKEN
SANITY_PROJECT_ID
SANITY_DATASET
  1. You will need to create or request an API token as well as get the reset of the information about running Sanity locally. You can ask @hexagoncircle for this information.
  2. To test locally, add a path in your .env for the GITHUB_WORKSPACE key or pass it in (pwd if you're in the root of the plugins project) e.g. GITHUB_WORKSPACE=$(pwd) NODE_ENV=development npx tsx bin/sync_plugins_to_cms.js.
  3. If there are changes detected, they will synchronize to the CMS
running in development mode
Detecting plugin changes...
Plugin diff found: netlify-plugin-gridsome-cache
Found 1 plugins with changes
Updating plugins...
Plugins were updated in the CMS.
  1. If there are none, it will report no changes.
running in development mode
Detecting plugin changes...
No plugin changes found.

Note that it will log running in development mode when in development mode only. This is to indicate that environment variables are being loaded via dotenv. When running in the GitHub Actions environment, environment secrets will be used.

Currently, a Sandbox environment is being used. To enable it for production:

  1. Create an environment for the repository called Production and add the following keys with production values.
SANITY_API_TOKEN
SANITY_PROJECT_ID
SANITY_DATASET
  1. Update the following lines from the GitHub Action, .github/workflows/sync-to-cms.yml
    environment:
-      # TODO: Rename this to Production once this is ready for production, i.e. when this is about to be merged into the repo
-      name: Sandbox
+      name: Production

and remove

-  # TODO: remove pull_request section once this is ready for production, i.e. when this is about to be merged into the repo
-  pull_request:
-    types: [opened, synchronize, reopened]

since we only want the GitHub action running when PRs are merged to main.

Drew Barrymore saying, "This is sync baby!"

@nickytonline nickytonline force-pushed the nickytonline/sync-plugins-with-sanity branch from 6ddf767 to a01a086 Compare August 30, 2022 21:04
@nickytonline nickytonline changed the title nickytonline/sync plugins with sanity feat: Plugin synchronization with Sanity Aug 30, 2022
@nickytonline nickytonline self-assigned this Aug 30, 2022
@nickytonline nickytonline force-pushed the nickytonline/sync-plugins-with-sanity branch 10 times, most recently from b90474e to 4c6a0cf Compare August 31, 2022 19:48
@nickytonline nickytonline marked this pull request as ready for review August 31, 2022 19:50
@nickytonline nickytonline changed the title feat: Plugin synchronization with Sanity feat: Plugin synchronization with Sanity DO NOT MERGE - TESTING GH ACTION Aug 31, 2022
@nickytonline nickytonline marked this pull request as draft August 31, 2022 19:51
@nickytonline nickytonline changed the title feat: Plugin synchronization with Sanity DO NOT MERGE - TESTING GH ACTION feat: Plugin synchronization with Sanity Aug 31, 2022
@nickytonline nickytonline force-pushed the nickytonline/sync-plugins-with-sanity branch 2 times, most recently from 03f279b to 0526301 Compare August 31, 2022 19:58
@nickytonline nickytonline temporarily deployed to Sandbox September 26, 2022 22:22 Inactive
@nickytonline nickytonline temporarily deployed to Sandbox September 26, 2022 23:19 Inactive
@nickytonline nickytonline temporarily deployed to Sandbox September 26, 2022 23:27 Inactive
@nickytonline
Copy link
Contributor Author

nickytonline commented Sep 26, 2022

So this is in a good state @hexagoncircle @estephinson. Since https://github.com/netlify/marketing-cms/pull/196 was merged, the compatibility field updates properly now.

We can discuss this tomorrow but this is probably what we want to do:

  1. Backup production dataset
  2. Set up production environment secrets for the required keys
  3. Remove the bits I mention here, https://github.com/netlify/plugins/pull/820/files#diff-73c78a9e1e66c6740e9214fb15c0c0fb947b00086b4d38835dcf79c84c5a030bR6-R13
  4. Notify team we're doing this
  5. Merge this PR
  6. GitHub action runs, and updates version and compatibility fields of plugins in Integration Hub (IH)

Monitor what happens the next time one of our repos puts up a PR for plugins.json changes, e.g. Next Runtime

@nickytonline nickytonline temporarily deployed to Sandbox September 27, 2022 04:22 Inactive
@nickytonline nickytonline temporarily deployed to Sandbox September 27, 2022 12:55 Inactive
@nickytonline nickytonline temporarily deployed to Sandbox September 27, 2022 12:58 Inactive
estephinson
estephinson previously approved these changes Sep 28, 2022
| {
version: string
migrationGuide: strings
migrationGuide: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch ha!

Comment on lines +3 to +9
pull_request:
types:
- closed
jobs:
sync-to-cms:
# Only run if the merged PR wasn't an automated PR for synching from the cms to the repo
if: github.event.pull_request.merged && !contains(github.event.pull_request.labels.*.name, 'cms_sync')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@estephinson @tzmanics, this is the guard to prevent a potential infinite loop of sync repo to cms/cms to repo I mentioned. Ed or whoever will need to reapprove the PR.

estephinson
estephinson previously approved these changes Sep 29, 2022
@nickytonline nickytonline merged commit 39f8af1 into main Oct 4, 2022
@nickytonline nickytonline deleted the nickytonline/sync-plugins-with-sanity branch October 4, 2022 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants