~sircmpwn/builds.sr.ht#170: 
Option to only deploy from a specific branch

One way I could see this being implemented is by adding a branch option to a task. The syntax might look something like this:

tasks:
 - deploy:
     branch: master
     run: |
       rsync ...

A current workaround would be:

tasks:
  - deploy: |
      cd repo_name
      # We only want to deploy when on master. We cain't just check if
      # --abbrev-ref is master since the HEAD is detached.
      if [ "$(git rev-parse master)" = "$(git rev-parse HEAD)" ]; then
        rsync ...
      else
        echo "Not on master, skipping..."
      fi
Status
REPORTED
Submitter
~nloomans
Assigned to
No-one
Submitted
4 years ago
Updated
4 years ago
Labels
No labels applied.

~vija02 4 years ago

+1 Would love to have this as an option. Related: https://todo.sr.ht/%7Esircmpwn/dispatch.sr.ht/15

~sircmpwn 4 years ago

Workaround: the special complete-build command can be used to end a build early (without failing it).

~djhenk 4 years ago

+1 for me as well. But combining your suggestions works, so no hurry.

tasks:

  • check-branch: | cd repo_name if [ "$(git rev-parse master)" != "$(git rev-parse HEAD)" ]; then
    complete-build;
    fi

~djhenk 4 years ago

Eh.. it says 'Markdown supported loud and clear. Still forgot it.

tasks: 
- check-branch: | 
   cd repo_name 
   if [ "$(git rev-parse master)" != "$(git rev-parse HEAD)" ]; then \        
      complete-build; \ 
   fi
Register here or Log in to comment, or comment via email.