Release automatically #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ====================================== | |
# 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 |