New version - 39.30 #26
Workflow file for this run
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
name: Release from tags | |
# Create a GitHub release when a tag is pushed. | |
# Input can ingest any string, but it will not work with arbitrary hashes. The code expects to get | |
# a tag that sits on a release commit, so that commit is automatically skipped. Similarly, it | |
# expects that the tag name conforms to a particular scheme. | |
on: | |
push: | |
tags: | |
# this is a glob, not a regexp | |
- 'anaconda-*' | |
workflow_dispatch: | |
inputs: | |
tag-ref: | |
# it might be possible to release from arbitrary ref, but only tags work | |
description: Name of the tag to release from, such as "anaconda-33.12-1". Branch names or arbitrary commit hashes are not supported. Make sure to trim whitespace when copying. | |
type: string | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
release-from-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Resolve tag reference | |
id: get_ref | |
# Get reference of the tag that is to be released. | |
# The tag can be in two places, depending on how the workflow was started. | |
run: | | |
if [ -n "${{ github.event.inputs.tag-ref }}" ] ; then | |
echo "Using tag from manual input: ${{ github.event.inputs.tag-ref }}" | |
echo "ref=${{ github.event.inputs.tag-ref }}" >> $GITHUB_OUTPUT | |
else | |
echo "Using tag from automatic input: ${{ github.ref }}" | |
echo "ref=${{ github.ref }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Extract version from the tag | |
id: get_version | |
# Get the actual version number from the tag, eg. anaconda-33.12-1 -> 33.12 | |
# If the version does not fit the regexp, we'll just fail. TODO maybe abort instead? | |
run: | | |
echo "Checking if ref ${{ steps.get_ref.outputs.ref }} is a valid release tag." | |
VER=$(echo ${{ steps.get_ref.outputs.ref }} | perl -ne '/^(?:refs\/tags\/)?anaconda-([0-9]+(?:\.[0-9]+){1,3})-1$/ && print "$1\n";') | |
if [ -z "$VER" ] ; then | |
echo "Tag ref ${{ steps.get_ref.outputs.ref }} is not a valid release tag." | |
exit 1 | |
else | |
echo "Tag ref ${{ steps.get_ref.outputs.ref }} detected as release version $VER." | |
echo "version=$VER" >> $GITHUB_OUTPUT | |
fi | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ steps.get_ref.outputs.ref }} | |
fetch-depth: 0 | |
- name: Build anaconda container (to make the release) | |
run: | | |
make -f Makefile.am anaconda-release-build | |
- name: Run the build in the container | |
run: | | |
mkdir /tmp/results | |
make -f Makefile.am container-release | |
# copy out stuff | |
cp anaconda-*.tar.bz2 /tmp/results | |
- name: Create the release | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_NAME: ${{ steps.get_version.outputs.version }} | |
run: | | |
# get changelog from spec file | |
# - get lines starting with %changelog, up to but excluding first following empty line | |
# - then drop the first two lines (start at 3rd) which are %changelog and *DATE COMMITTER | |
sed -n '/%changelog/,/^$/{/^$/!p}' anaconda.spec.in | sed -n '3,$ p' | tee release.txt | |
echo "- Update translations from Weblate" >> release.txt | |
# drop line ending | |
truncate -s -1 release.txt | |
# create release with the release notes | |
gh release create \ | |
${{ steps.get_ref.outputs.ref }} \ | |
--title "Anaconda $RELEASE_NAME" \ | |
--notes-file release.txt \ | |
/tmp/results/* |