Skip to content

Commit 689a197

Browse files
committed
Implement Repository dispatch (#11)
* Add dispatch repository workflow & download artifact on repository_dispatch event * Create a new branch & a pull request
1 parent 50dcf79 commit 689a197

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

.github/workflows/build_demo.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build Demo
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
jobs:
8+
build_demo_archive:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Get the version
13+
id: get_version
14+
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v*}
15+
- name: Build Demo
16+
run: echo ${{ steps.get_version.outputs.VERSION }}
17+
- name: Upload Demo
18+
uses: actions/upload-artifact@v2
19+
with:
20+
name: demo-${{github.sha}}
21+
path: LICENSE
22+
- name: Repository Dispatch
23+
if: startsWith(github.ref, 'refs/tags/')
24+
uses: peter-evans/repository-dispatch@v1
25+
with:
26+
token: ${{ secrets.ACCESS_TOKEN }}
27+
repository: process-analytics/github-actions-playground
28+
event-type: update_bpmn_visualization_version
29+
client-payload: '{
30+
"build_demo_repo": "${{ github.repository }}",
31+
"build_demo_workflow_id": "build_demo.yml",
32+
"demo_sha": "${{ github.sha }}",
33+
"version": "${{ steps.get_version.outputs.VERSION }}"
34+
}'

.github/workflows/download_demo.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Update BPMN Visualization version
2+
on:
3+
repository_dispatch:
4+
types: [update_bpmn_visualization_version]
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version'
9+
required: true
10+
build_demo_repo:
11+
description: 'The repository where the demo artifact is stored'
12+
default: "process-analytics/download-workflow-artifact"
13+
build_demo_workflow_id:
14+
description: 'The workflow identifier where the demo artifact is stored'
15+
default: "build_demo"
16+
demo_sha:
17+
description: 'SHA from the demo artifact name'
18+
required: true
19+
20+
jobs:
21+
updateVersion:
22+
runs-on: ubuntu-20.04
23+
env:
24+
VERSION: ${{ github.event.client_payload.version || github.event.inputs.version }}
25+
DEMO_SHA: ${{ github.event.client_payload.demo_sha || github.event.inputs.demo_sha }}
26+
BUILD_DEMO_WORKFLOW_ID: ${{ github.event.client_payload.build_demo_workflow_id || github.event.inputs.build_demo_workflow_id }}
27+
BUILD_DEMO_REPO: ${{ github.event.client_payload.build_demo_repo || github.event.inputs.build_demo_repo }}
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: Update examples
31+
run: echo "Examples updated with version ${{ env.VERSION }}"
32+
- name: Download Demo ${{ env.VERSION }}
33+
uses: dawidd6/action-download-artifact@v2
34+
with:
35+
github_token: ${{ secrets.ACCESS_TOKEN }}
36+
repo: ${{ env.BUILD_DEMO_REPO }}
37+
workflow: ${{ env.BUILD_DEMO_WORKFLOW_ID }}
38+
workflow_conclusion: success
39+
name: demo-${{ env.DEMO_SHA }}
40+
path: path/to/artifact
41+
- name: Display structure of downloaded files
42+
run: ls -R
43+
working-directory: path/to/artifact
44+
- name: Create Pull Request
45+
uses: peter-evans/create-pull-request@v3
46+
with:
47+
commit-message: "Commit & Push changes"
48+
committer: "GitHub <[email protected]>"
49+
author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
50+
branch: "infra/update_bpmn_visualization_to_${{ env.VERSION }}"
51+
delete-branch: true
52+
base: "master"
53+
title: "[INFRA] Update BPMN Visualization version to ${{ env.VERSION }}"
54+
body: "https://cdn.statically.io/gh/process-analytics/bpmn-visualization-examples/infra/update_bpmn_visualization_to_${{ env.VERSION }}/examples/index.html"
55+
labels: "enhancement"
56+
reviewers: "csouchet"
57+
draft: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea/

0 commit comments

Comments
 (0)