Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Publish Targets #1957

Merged
merged 2 commits into from
Nov 2, 2020
Merged

Add Publish Targets #1957

merged 2 commits into from
Nov 2, 2020

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Oct 30, 2020

What is this pull request for?

A publish target is a ActiveJob compatible Ruby class that gets performed when the user publishes a page.

You can use that to send webhooks to hosting services, notification services or ci services.

Example

# app/jobs/publish_job.rb
class PublishJob < ApplicationJob
  def perform(page)
    RestClient.post(ENV['BUILD_HOOK_URL'])
  end
end
# config/initializers/alchemy.rb
Alchemy.publish_targets << PublishJob

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

A publish target is a ActiveJob compatible Ruby class that gets performed when the user publishes a page. You can use that to send webhooks to hosting services, notification services or ci services.

== Example

    # app/jobs/publish_job.rb
    class PublishJob < ApplicationJob
      def perform(page)
        RestClient.post(ENV['BUILD_HOOK_URL'])
      end
    end

    # config/initializers/alchemy.rb
    Alchemy.publish_targets << PublishJob
@tvdeyen tvdeyen requested a review from mamhoff October 30, 2020 08:32
@tvdeyen tvdeyen added this to the 5.1 milestone Oct 30, 2020
@tvdeyen tvdeyen mentioned this pull request Nov 2, 2020
3 tasks
Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

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

So simple! 😍

@tvdeyen tvdeyen merged commit 50f6437 into AlchemyCMS:main Nov 2, 2020
@tvdeyen tvdeyen deleted the publish-targets branch November 2, 2020 17:51
tvdeyen added a commit that referenced this pull request Nov 6, 2020
- Allow multiple preview sources [#1959](#1959) ([tvdeyen](https://github.com/tvdeyen))
- Add Publish Targets [#1957](#1957) ([tvdeyen](https://github.com/tvdeyen))
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.

None yet

2 participants