forked from Samsung/TizenFX
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (54 loc) · 1.93 KB
/
nightly-release.yml
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
name: "Nightly Release"
on:
schedule:
- cron: '0 15 * * *'
workflow_dispatch:
env:
TARGET_BRANCHES: 'master API10 API9'
jobs:
nightly:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find Branches to Release
id: find-targets
run: |
TARGETS=""
# find branches without the version tag
for x in $TARGET_BRANCHES; do
tags=$(git tag --contains origin/$x)
if [[ ! $tags =~ v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
TARGETS="${TARGETS} $x"
fi
done
echo "targets=${TARGETS}" >> $GITHUB_OUTPUT
- name: Trigger Release
uses: actions/github-script@v6
env:
TARGETS: ${{ steps.find-targets.outputs.targets }}
WORKFLOW_NAME: 'Deploy Packages'
with:
github-token: ${{ secrets.TIZENAPI_GITHUB_TOKEN }}
script: |
var resp = await github.request('GET /repos/{owner}/{repo}/actions/workflows', {
owner: context.repo.owner,
repo: context.repo.repo
})
if (resp.status != 200) throw new Error('Failed to get workflow list.')
var workflow = resp.data.workflows.find(w => {
return w['name'] === process.env.WORKFLOW_NAME
})
if (!workflow) throw new Error('Unable to find the workflow.')
var targets = process.env.TARGETS.trim().split(' ')
targets.forEach(async target => {
var dispatchResp = await github.request('POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', {
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflow.id,
ref: 'master',
inputs: { target, deploy_to_gpr: 'true', deploy_to_myget: 'true', deploy_to_tizen: 'true' }
})
console.log(`Event dispatch for ${target} : ${dispatchResp.status}`)
})