Skip to content

Commit

Permalink
Implement Repository dispatch (#11)
Browse files Browse the repository at this point in the history
* Add dispatch repository workflow & download artifact on repository_dispatch event
* Create a new branch & a pull request
  • Loading branch information
csouchet committed Mar 3, 2021
1 parent 50dcf79 commit 689a197
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build_demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Demo
on:
push:
tags:
- v*

jobs:
build_demo_archive:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v*}
- name: Build Demo
run: echo ${{ steps.get_version.outputs.VERSION }}
- name: Upload Demo
uses: actions/upload-artifact@v2
with:
name: demo-${{github.sha}}
path: LICENSE
- name: Repository Dispatch
if: startsWith(github.ref, 'refs/tags/')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository: process-analytics/github-actions-playground
event-type: update_bpmn_visualization_version
client-payload: '{
"build_demo_repo": "${{ github.repository }}",
"build_demo_workflow_id": "build_demo.yml",
"demo_sha": "${{ github.sha }}",
"version": "${{ steps.get_version.outputs.VERSION }}"
}'
57 changes: 57 additions & 0 deletions .github/workflows/download_demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Update BPMN Visualization version
on:
repository_dispatch:
types: [update_bpmn_visualization_version]
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
build_demo_repo:
description: 'The repository where the demo artifact is stored'
default: "process-analytics/download-workflow-artifact"
build_demo_workflow_id:
description: 'The workflow identifier where the demo artifact is stored'
default: "build_demo"
demo_sha:
description: 'SHA from the demo artifact name'
required: true

jobs:
updateVersion:
runs-on: ubuntu-20.04
env:
VERSION: ${{ github.event.client_payload.version || github.event.inputs.version }}
DEMO_SHA: ${{ github.event.client_payload.demo_sha || github.event.inputs.demo_sha }}
BUILD_DEMO_WORKFLOW_ID: ${{ github.event.client_payload.build_demo_workflow_id || github.event.inputs.build_demo_workflow_id }}
BUILD_DEMO_REPO: ${{ github.event.client_payload.build_demo_repo || github.event.inputs.build_demo_repo }}
steps:
- uses: actions/checkout@v2
- name: Update examples
run: echo "Examples updated with version ${{ env.VERSION }}"
- name: Download Demo ${{ env.VERSION }}
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
repo: ${{ env.BUILD_DEMO_REPO }}
workflow: ${{ env.BUILD_DEMO_WORKFLOW_ID }}
workflow_conclusion: success
name: demo-${{ env.DEMO_SHA }}
path: path/to/artifact
- name: Display structure of downloaded files
run: ls -R
working-directory: path/to/artifact
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: "Commit & Push changes"
committer: "GitHub <noreply@github.com>"
author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
branch: "infra/update_bpmn_visualization_to_${{ env.VERSION }}"
delete-branch: true
base: "master"
title: "[INFRA] Update BPMN Visualization version to ${{ env.VERSION }}"
body: "https://cdn.statically.io/gh/process-analytics/bpmn-visualization-examples/infra/update_bpmn_visualization_to_${{ env.VERSION }}/examples/index.html"
labels: "enhancement"
reviewers: "csouchet"
draft: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.idea/

0 comments on commit 689a197

Please sign in to comment.