Skip to content

Nightly Release

Nightly Release #80

name: "Nightly Release"
on:
schedule:
- cron: '0 15 * * *'
workflow_dispatch:
env:
TARGET_BRANCHES: 'master API11 API10'
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}`)
})