Skip to content

Commit

Permalink
Merge pull request #23 from beuluis/feature/feature-dist-tag
Browse files Browse the repository at this point in the history
Feature/feature dist tag
  • Loading branch information
beuluis committed Feb 20, 2023
2 parents 77bed2a + 653a52e commit 0afd004
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To publish this PR to the registry select this checkbox.

- [ ] Publish to registry
26 changes: 17 additions & 9 deletions .github/workflows/feature-npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@ on:
- opened # pr is created
- reopened # pr is reopened
- synchronize # pr got new commit
- closed # pr is merged/closed
- edited # pr checkbox is edited

jobs:
check-pr:
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' || github.event.action == 'edited' }}
runs-on: ubuntu-latest
outputs:
shouldRun: ${{ steps.check-pr.outputs.shouldRun }}
steps:
- name: Check the PR for checkbox
uses: bahmutov/should-run-github-action@v1
id: check-pr
with:
checkbox_text: 'Publish to registry'
env:
GITHUB_EVENT: ${{ toJson(github.event) }}

publish-feature-tag:
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }}
needs: check-pr
if: ${{ needs.check-pr.outputs.shouldRun }}
uses: beuluis/reusable-workflows/.github/workflows/publish-npm.yml@main
with:
dist_tag: ${{ github.head_ref }}
secrets: inherit

remove-feature-tag:
if: ${{ github.event.action == 'closed' }}
uses: beuluis/reusable-workflows/.github/workflows/remove-dist-tag-npm.yml@main
with:
dist_tag: ${{ github.head_ref }}
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/feature-npm-remove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Handling feature dist-tag'

on:
pull_request:
branches:
- main
types:
- closed # pr is merged/closed

jobs:
remove-feature-tag:
if: ${{ github.event.action == 'closed' }}
uses: beuluis/reusable-workflows/.github/workflows/remove-dist-tag-npm.yml@main
with:
dist_tag: ${{ github.head_ref }}
secrets: inherit

0 comments on commit 0afd004

Please sign in to comment.