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

Prevent deployment of pre-releases #5

Open
2ndkauboy opened this issue Sep 4, 2019 · 9 comments
Open

Prevent deployment of pre-releases #5

2ndkauboy opened this issue Sep 4, 2019 · 9 comments
Labels
help wanted Extra attention is needed needs:documentation This requires documentation. type:enhancement New feature or request.
Milestone

Comments

@2ndkauboy
Copy link

Is your enhancement related to a problem? Please describe.
When developing a plugin on GitHub, it's not uncommon to tag pre-releases (like beta and release candidates). Those tags would also trigger a deployment on the plugin directory.

Describe the solution you'd like
The action currently runs on all tags. With a simple addition, which excludes all tags with a suffix (e.g. 2.0.0-beta, 2.0.0-RC1, etc.) such pre-release tags would not trigger the action.

name: Deploy to WordPress.org
on:
  push:
    tags:
    - "*"
    - "!*-*"
...

Additional context
This change can be done without chaning the files of the actions, it should only be added to the README of this repo.

@2ndkauboy 2ndkauboy added the type:enhancement New feature or request. label Sep 4, 2019
@helen
Copy link
Collaborator

helen commented Sep 4, 2019

Do you typically do these tags on master or do you tag on a development branch? Some people do deploy these to .org, FWIW :) We can certainly add more examples, I'd just love to know more about what you're doing as we develop these.

@2ndkauboy
Copy link
Author

I think the way GitHub actions work, there is no difference if you create a tag on master or any other branch.

I personally don't tags/publish pre-releases, but for some plugins I help to maintain, we use pre-release tags. We usually do them on master.

@helen
Copy link
Collaborator

helen commented Sep 4, 2019

I'm actually not sure about the tag+branch filtering? I suppose a tag is not technically pushed to a branch but I do wonder if they can somehow be combined in the way GitHub is using them, since a tag does know which branch that tagged commit was on. In any case, if it's all being done on master that doesn't change anything. Does it make sense to keep adding examples to the readme or would it be better to have a separate reference?

@2ndkauboy
Copy link
Author

I would just add an example to the readme. Either with this as an addition/alternative or by just explaining the new line.

@helen
Copy link
Collaborator

helen commented Sep 5, 2019

Copying my comment to @sc0ttkclark over here:

I am worried about exactly what you experienced, which is that as people are getting these things set up for the first time, they won't quite understand that they may need to remove stuff from the sample workflow file, so maybe it should be a barebones example and link off to more examples in a separate document.

@helen helen added needs:documentation This requires documentation. type:enhancement New feature or request. and removed type:enhancement New feature or request. labels Sep 5, 2019
@danieliser
Copy link

danieliser commented Feb 14, 2020

@2ndkauboy - Simply update your action script. This is ours using semver.

It works with v1.0.0, but not with v1.1.0-alpha.1 or v2.0-beta.3 etc

name: Deploy to WordPress.org
on:
  push:
    tags:
    - 'v*'
    - '!v*-alpha*'
    - '!v*-beta*'
    - '!v*-rc*'

This works, but there is also tags-ignore

name: Deploy to WordPress.org
on:
  push:
    tags-ignore:
    - 'v*-alpha*'
    - 'v*-beta*'
    - 'v*-rc*'

Documented here: https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags

@johnbillion
Copy link

johnbillion commented Apr 21, 2020

Another option is to use the release event instead of push.tags and then the workflow will only fire when you publish the release on GitHub. The published type will only fire for published, non-prerelease releases.

on:
  release:
    types: [released]

Edit: Changed the above to released instead of published.

@GaryJones
Copy link

The published type will only fire for published, non-prerelease releases.

That's not the case according to https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#release (my emphasis):

If you want a workflow to run when stable and pre-releases publish, subscribe to published instead of released and prereleased.

@jeffpaul
Copy link
Member

@GaryJones nice catch! Adding a task here for us to document that:

  • add note to readme about different release types to list based on how a specific plugin handles releases (including stable and pre-releases)

@jeffpaul jeffpaul added this to the 2.1.0 milestone Jan 5, 2022
@jeffpaul jeffpaul added the help wanted Extra attention is needed label Jan 5, 2022
@jeffpaul jeffpaul modified the milestones: 2.1.0, 2.2.0 May 11, 2022
@jeffpaul jeffpaul modified the milestones: 2.2.0, 2.3.0 May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs:documentation This requires documentation. type:enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

6 participants