我想设置我的工作流程以执行以下操作:
在我的.github/workflows
中,on
指令适用于所有作业,因此在我的情况下不起作用。另一方面,action/upload-artifact
仅在同一工作流程内工作。
实现上述工作流程的正确方法是什么?
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
submodules: true
- name: Build
run: make all
- uses: actions/upload-artifact@v2
with:
name: build
path: dist/
- name: Deploy to GitHub Pages
filters: # <-----<<<< What I would like to do
branch: master
uses: JamesIves/github-pages-deploy-action@3.5.9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist/html
答案 0 :(得分:4)
您可以在步骤中添加条件,并仅跳过不需要的部分,请参见jobs.<id>.steps.if
。至于要检查的内容,RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^(.+)\.php$ /$1 [R,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,END]
Options -Indexes
上下文是与当前正在运行的工作流程相关的各种数据的金矿。例如
github
以此类推。
请注意,mentioned in documentation部分只是冰山一角; github.event_name string The name of the event that triggered the workflow run.
github.ref string The branch or tag ref that triggered the workflow run.
github.head_ref string The head_ref or source branch of the pull request in a workflow run.
包含有用的东西。最好在某些测试工作流程中take a look,看看每个事件提供了什么。
类似的方法应该起作用:
github.event
- name: On any event (pull-request, push on any branches)
uses: some/action
- name: Only when master is pushed
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: some/action