From 8c8fea9a51460b8f484f294b08859aad1fced380 Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Wed, 26 Jul 2023 12:16:54 +0200 Subject: [PATCH 1/5] Try adding auto-release toot workflow --- .../.github/workflows/mastodon.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nf_core/pipeline-template/.github/workflows/mastodon.yml diff --git a/nf_core/pipeline-template/.github/workflows/mastodon.yml b/nf_core/pipeline-template/.github/workflows/mastodon.yml new file mode 100644 index 000000000..3cf7c80d3 --- /dev/null +++ b/nf_core/pipeline-template/.github/workflows/mastodon.yml @@ -0,0 +1,18 @@ +name: toot-release + +on: + release: + types: [published] + +jobs: + toot: + runs-on: ubuntu-latest + steps: + - uses: rzr/fediverse-action@master + with: + access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} + host: "mstdn.science" # custom host if not "mastodon.social" (default) + # GitHub event payload + # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release + # repo name can be queried with ${{ github.event.repository.name }} + message: "Pipeline release {{ name }} v${{ github.event.release.tag_name }} - ${{ github.event.release.tag_name }}! Please see the release notes: ${{ github.event.release.html_url }}" From 4a1827ff5bacc51c17c027cf9c69ce6d1a4f645d Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Wed, 26 Jul 2023 12:52:34 +0200 Subject: [PATCH 2/5] Add X to the workflow --- .../.github/workflows/mastodon.yml | 18 ------ .../workflows/release-announcments.yml | 56 +++++++++++++++++++ 2 files changed, 56 insertions(+), 18 deletions(-) delete mode 100644 nf_core/pipeline-template/.github/workflows/mastodon.yml create mode 100644 nf_core/pipeline-template/.github/workflows/release-announcments.yml diff --git a/nf_core/pipeline-template/.github/workflows/mastodon.yml b/nf_core/pipeline-template/.github/workflows/mastodon.yml deleted file mode 100644 index 3cf7c80d3..000000000 --- a/nf_core/pipeline-template/.github/workflows/mastodon.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: toot-release - -on: - release: - types: [published] - -jobs: - toot: - runs-on: ubuntu-latest - steps: - - uses: rzr/fediverse-action@master - with: - access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} - host: "mstdn.science" # custom host if not "mastodon.social" (default) - # GitHub event payload - # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release - # repo name can be queried with ${{ github.event.repository.name }} - message: "Pipeline release {{ name }} v${{ github.event.release.tag_name }} - ${{ github.event.release.tag_name }}! Please see the release notes: ${{ github.event.release.html_url }}" diff --git a/nf_core/pipeline-template/.github/workflows/release-announcments.yml b/nf_core/pipeline-template/.github/workflows/release-announcments.yml new file mode 100644 index 000000000..4a2e92429 --- /dev/null +++ b/nf_core/pipeline-template/.github/workflows/release-announcments.yml @@ -0,0 +1,56 @@ +name: release-announcements + +on: + release: + types: [published] + +jobs: + toot: + runs-on: ubuntu-latest + steps: + - uses: rzr/fediverse-action@master + with: + access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} + host: "mstdn.science" # custom host if not "mastodon.social" (default) + # GitHub event payload + # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release + message: | + Pipeline release! ${{ github.repository }} v${{ github.event.release.tag_name }} - ${{ github.event.release.name }}! + + Please see the changelog: ${{ github.event.release.html_url }} + + send-tweet: + needs: [release] + if: needs.release.result == 'success' + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies + run: pip install tweepy==4.14.0 + - name: Send tweet + shell: python + run: | + import os + import tweepy + + client = tweepy.Client( + access_token=os.getenv("TWITTER_ACCESS_TOKEN"), + access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET"), + consumer_key=os.getenv("TWITTER_CONSUMER_KEY"), + consumer_secret=os.getenv("TWITTER_CONSUMER_SECRET"), + ) + version = os.getenv("VERSION").strip('"') + tweet = os.getenv("TWEET").format(version=version) + client.create_tweet(text=tweet) + env: + TWEET: | + Pipeline release! ${{ github.repository }} v${{ github.event.release.tag_name }} - ${{ github.event.release.name }}! + + Please see the changelog: ${{ github.event.release.html_url }} + TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} + TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} + TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} From 02a11676545602bb11daf90ed446817bf495e6fa Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Wed, 26 Jul 2023 12:53:01 +0200 Subject: [PATCH 3/5] Fix GHA syntax --- .../.github/workflows/release-announcments.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/nf_core/pipeline-template/.github/workflows/release-announcments.yml b/nf_core/pipeline-template/.github/workflows/release-announcments.yml index 4a2e92429..8b7116855 100644 --- a/nf_core/pipeline-template/.github/workflows/release-announcments.yml +++ b/nf_core/pipeline-template/.github/workflows/release-announcments.yml @@ -20,8 +20,6 @@ jobs: Please see the changelog: ${{ github.event.release.html_url }} send-tweet: - needs: [release] - if: needs.release.result == 'success' runs-on: ubuntu-latest steps: From e4b5798656a8f367980b86ab2da71ea16f7fa4fe Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jul 2023 08:54:44 +0200 Subject: [PATCH 4/5] Update nf_core/pipeline-template/.github/workflows/release-announcments.yml --- .../pipeline-template/.github/workflows/release-announcments.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/nf_core/pipeline-template/.github/workflows/release-announcments.yml b/nf_core/pipeline-template/.github/workflows/release-announcments.yml index 8b7116855..5f8b46c04 100644 --- a/nf_core/pipeline-template/.github/workflows/release-announcments.yml +++ b/nf_core/pipeline-template/.github/workflows/release-announcments.yml @@ -3,6 +3,7 @@ name: release-announcements on: release: types: [published] + workflow_dispatch: jobs: toot: From 47aee1dd1c179bc2f5b27d3fdd633fb5a2db0546 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 17 Aug 2023 14:55:42 +0200 Subject: [PATCH 5/5] add jinja raw for template rendering and update changelog --- CHANGELOG.md | 1 + .../.github/workflows/release-announcments.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8680b1ee..7dc20686e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix links in `multiqc_config.yml` ([#2372](https://github.com/nf-core/tools/pull/2372)) - Remove default false from nextflow_schema.json ([#2376](https://github.com/nf-core/tools/pull/2376)) - Add module MULTIQC to modules.config ([#2377](https://github.com/nf-core/tools/pull/2377)) +- Add GitHub workflow for automated release announcements ([#2382](https://github.com/nf-core/tools/pull/2382)) ### Download diff --git a/nf_core/pipeline-template/.github/workflows/release-announcments.yml b/nf_core/pipeline-template/.github/workflows/release-announcments.yml index 5f8b46c04..f2a45d714 100644 --- a/nf_core/pipeline-template/.github/workflows/release-announcments.yml +++ b/nf_core/pipeline-template/.github/workflows/release-announcments.yml @@ -1,5 +1,5 @@ name: release-announcements - +# Automatic release toot and tweet anouncements{%- raw %} on: release: types: [published] @@ -53,3 +53,4 @@ jobs: TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + #{%- endraw %}