-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (59 loc) · 2.27 KB
/
release-trigger.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: ReleaseTrigger
on:
workflow_dispatch:
inputs:
execution:
description: 'Type of execution'
required: true
default: 'Manual'
type: choice
options:
- Manual
schedule:
# * is a special character in YAML, so we have to quote this string
- cron: '0 4 5 * *'
jobs:
build:
name: Release trigger action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0
token: ${{ secrets.PUBLISH_KEY }}
- name: "Check existing tag"
id: check
run: |
echo "::set-output name=has_tag::$(git log --format='format:%d' --decorate-refs="refs/tags/v*" -n 1 | grep tag | wc -l)"
- name: Debug
run: |
echo "Has tag: ${{ steps.check.outputs.has_tag }}"
echo "---"
echo "Execution: ${{ github.event.inputs.execution }}"
echo "---"
echo "Should run: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}"
- name: "Update trigger"
if: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}
run: |
date +%s > .release-trigger
- name: "git branch"
if: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}
run: |
git config --global user.name 'Esta Nagy'
git config --global user.email '[email protected]'
git checkout -b release/run-${{ github.run_number }}
git add .release-trigger
git commit -asm "Triggering a release {patch}"
git push -f --set-upstream origin release/run-${{ github.run_number }}
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
if: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}
with:
github-token: ${{ secrets.PUBLISH_KEY }}
script: |
github.rest.pulls.create({
owner: "${{ github.repository_owner }}",
repo: "abort-mission",
head: "release/run-${{ github.run_number }}",
base: "main",
title: "Triggering a release {patch}"
});