【发布时间】:2022-11-20 20:47:30
【问题描述】:
I am trying to build a Continuous Deployment workflow via GitHub Actions.
As a background context, this is a Clojure/ClojureScript project - specifically, a dependency on a dynamic web app.
As the outcome of the CD workflow, I want to have Maven packages
published on GitHub packages after every time the file project.clj
is changed.
Why this file? Because it holds the project version! Usually, when someone edit this file it is because it is a new version. Hence, it makes sense for a new version to be automatically published as a dependency.
Ok. I have achieved somethingcloseto what I want. Packages have been automatically published!
However, they are being published even when someone JUST submits a Pull Request.
I want the package to be published (CD to be triggered) on the following conditions:
1 - after direct changes on main branch; or,
2 - after a Pull Request isMERGED.
Ido notwant a package to be published if the Pull Request isonly submitted.
This is my cd.yml file:
name: 'cd'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'project.clj'
pull_request:
paths:
- 'project.clj'
What do I need to change on the workflow dispatch?
Only removing the last 3 lines will do the trick?
【问题讨论】:
-
Both conditions 1 and 2 are covered by the
pushtrigger that you already have defined so... yeah, removepull_requesttrigger.
标签: package github-actions workflow publish continuous-deployment