-
Notifications
You must be signed in to change notification settings - Fork 355
88 lines (76 loc) · 3.31 KB
/
release-automatically.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
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
# ======================================
# WARNING!
# THIS FILE IS GENERATED FROM A TEMPLATE
# DO NOT EDIT THIS FILE MANUALLY!
# ======================================
# The template is located in: release-automatically.yml.j2
name: Release automatically
# Create a GitHub release on schedule or trigger it manually. Only Rawhide releases should
# be triggered automatically on schedule, RHEL and Fedora releases have to be triggered manually.
# This only makes a tag and pushes it, which is then picked up by another action that builds
# the tarball and posts the actual release entity/page with it. See: release-from-tag.yml
# If the branch already has a tag at the last commit, there is nothing to release, so abort.
on:
workflow_dispatch:
schedule:
- cron: 48 4 * * TUE
# GH workers run on UTC+0 time. The timing is so that the draft can be reviewed at start of
# work day in Brno which is in UTC+1 or UTC+2.
# Tuesdays are the traditional rawhide anaconda release day, so that there are enough days to
# unbreak things.
permissions:
contents: write
jobs:
make-release-tag:
# Don't run scheduled workflows on forks.
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
runs-on: ubuntu-latest
environment: releases
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
token: ${{ secrets.INSTALLKER_TOKEN }}
- name: Check if already tagged
id: check-tag
run: |
# expected retvals and outputs for `git describe`:
# 128 -> fatal: no tag exactly matches 'c88a1272ffbc002042fd62ed409734c1c150cc5f'
# 0 -> anaconda-38.6-1
if git describe --tags --exact-match ; then
echo "::warning:: Already tagged at HEAD, will not push a release commit."
else
echo "can_bump_version=true" >> $GITHUB_OUTPUT
fi
- name: Prepare and tag a release commit
if: steps.check-tag.outputs.can_bump_version
run: |
git config user.name github-actions
git config user.email [email protected]
./scripts/makebumpver -c
- name: Push the release commit with the tag to repo
if: steps.check-tag.outputs.can_bump_version
# the repo should have an access token from the checkout action
# https://github.com/actions/checkout#Push-a-commit-using-the-built-in-token
run: |
tag_to_push=$(git describe --tags --exact-match)
if [ -n "${tag_to_push}" ] ; then
git push --atomic origin ${{ github.ref_name }} "$tag_to_push"
else
exit 1
fi
- name: Notify in Slack
if: steps.check-tag.outputs.can_bump_version
# https://api.slack.com/messaging/webhooks
run: |
curl \
-X POST \
-H 'Content-Type: application/json' \
--data '{"text":"New release tagged, please review the Packit dist-git PR soon to be found at https://src.fedoraproject.org/rpms/anaconda/pull-requests"}' \
'${{ secrets.SLACK_URL }}'
# This only makes a tag and pushes it, which is then picked up by another action that builds
# the tarball and posts the actual release entity/page with it.
#
# See: release-from-tag.yml