forked from opendatahub-io/data-science-pipelines-operator
-
Notifications
You must be signed in to change notification settings - Fork 8
131 lines (127 loc) · 4.71 KB
/
release_create.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: "Release Create"
run-name: Create Release
on:
workflow_run:
workflows: ["Release Trigger Create"]
types:
- completed
env:
DSPO_REPOSITORY: data-science-pipelines-operator
DSP_REPOSITORY: data-science-pipelines
GH_USER_NAME: dsp-developers
jobs:
fetch-data:
name: Fetch workflow payload
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
outputs:
target_version_tag: ${{ steps.vars.outputs.target_version_tag }}
previous_version_tag: ${{ steps.vars.outputs.previous_version_tag }}
release_branch: ${{ steps.vars.outputs.release_branch }}
odh_org: ${{ steps.vars.outputs.odh_org }}
pr_number: ${{ steps.vars.outputs.pr_number }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip
- shell: bash
id: vars
run: ./.github/scripts/release_create/vars.sh
validate_pr:
name: Validate PR
runs-on: ubuntu-latest
needs: fetch-data
steps:
- name: checkout
uses: actions/checkout@v3
- name: validate
env:
PR_NUMBER: ${{ needs.fetch-data.outputs.pr_number }}
TARGET_VERSION_TAG: ${{ needs.fetch-data.outputs.target_version_tag }}
DSPO_REPOSITORY: data-science-pipelines-operator
ODH_ORG: ${{ needs.fetch-data.outputs.odh_org }}
GH_TOKEN: ${{ github.token }}
run: ./.github/scripts/release_create/validate_pr.sh
create_dspo_tag_release:
name: Create DSPO Release
runs-on: ubuntu-latest
needs:
- fetch-data
- validate_pr
steps:
- name: checkout
uses: actions/checkout@v3
- name: Creates a DSPO release in GitHub
env:
GITHUB_TOKEN: ${{ github.token }}
GH_USER_NAME: ${{ env.GH_USER_NAME }}
TARGET_VERSION_TAG: ${{ needs.fetch-data.outputs.target_version_tag }}
PREVIOUS_VERSION_TAG: ${{ needs.fetch-data.outputs.previous_version_tag }}
RELEASE_BRANCH: ${{ needs.fetch-data.outputs.release_branch }}
REPOSITORY: ${{ needs.fetch-data.outputs.odh_org }}/${{ env.DSPO_REPOSITORY }}
GH_ORG: ${{ needs.fetch-data.outputs.odh_org }}
WORKING_DIR: ${{ github.workspace }}
shell: bash
run: ./.github/scripts/release_create/create_tag_release.sh
create_dsp_tag_release:
name: Create DSP Release
runs-on: ubuntu-latest
needs:
- fetch-data
- validate_pr
steps:
- name: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.DSP_DEVS_ACCESS_TOKEN }}
- name: Creates a DSPO release in GitHub
env:
GITHUB_TOKEN: ${{ secrets.DSP_DEVS_ACCESS_TOKEN }}
GH_USER_NAME: ${{ env.GH_USER_NAME }}
TARGET_VERSION_TAG: ${{ needs.fetch-data.outputs.target_version_tag }}
PREVIOUS_VERSION_TAG: ${{ needs.fetch-data.outputs.previous_version_tag }}
RELEASE_BRANCH: ${{ needs.fetch-data.outputs.release_branch }}
REPOSITORY: ${{ needs.fetch-data.outputs.odh_org }}/${{ env.DSP_REPOSITORY }}
GH_ORG: ${{ needs.fetch-data.outputs.odh_org }}
WORKING_DIR: ${{ github.workspace }}
shell: bash
run: ./.github/scripts/release_create/create_tag_release.sh
notify_pr:
name: Report Feedback
runs-on: ubuntu-latest
needs:
- validate_pr
- fetch-data
- create_dspo_tag_release
- create_dsp_tag_release
steps:
- uses: actions/checkout@v3
- name: Notify in Pull Request
env:
GITHUB_TOKEN: ${{ secrets.DSP_DEVS_ACCESS_TOKEN }}
PR_NUMBER: ${{ needs.fetch-data.outputs.pr_number }}
TARGET_VERSION_TAG: ${{ needs.fetch-data.outputs.target_version_tag }}
GH_ORG: ${{ needs.fetch-data.outputs.odh_org }}
run: ./.github/scripts/release_create/notify.sh