Skip to content

ci: Restructure release workflow #10

ci: Restructure release workflow

ci: Restructure release workflow #10

Workflow file for this run

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A workflow to build and release fresh binaries.
name: Release
# Runs when a new tag is created. Creates a release for that tag, then builds
# ffmpeg and ffprobe on all OS & CPU combinations, then attaches them to the
# release.
on:
push:
tags:
- "*"
# NOTE: Set the repository variable ENABLE_DEBUG to enable debugging via tmate on
# failure.
# NOTE: Set the repository variable ENABLE_SELF_HOSTED to enable self-hosted
# runners such as linux-arm64. This is set on the official repo, but forks
# will have to opt in after setting up their own self-hosted runners.
jobs:
build:
uses: ./.github/workflows/build.yaml
with:
ref: ${{ github.ref }}
publish_release:
name: Publish release
needs: [build]
runs-on: ubuntu-latest
permissions:
# "Write" to contents is necessary to create a release.
contents: write
steps:
- uses: actions/checkout@v4
with:
path: repo-src
ref: ${{ github.ref }}
- uses: actions/download-artifact@v4
with:
path: assets
merge-multiple: true
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
set -x
# Compile the release notes (the "body" of the release) with the date
# and the versions of the software we built.
# The format provided by "date -I" is "YYYY-MM-DD".
echo "Date:" >> body.txt
echo " - $(date -I)" >> body.txt
echo "" >> body.txt
echo "${{ github.repository }} version:" >> body.txt
echo " - ${{ github.ref_name }}" >> body.txt
echo "" >> body.txt
echo "Software versions:" >> body.txt
cat repo-src/versions.txt | \
sed -e 's/^/ - /' >> body.txt
echo "" >> body.txt
# Add the MD5 sums to the release notes.
echo "MD5 sums:" >> body.txt
(cd assets; md5sum * | sed -e 's/^/ - /') >> body.txt
# Publish the release, including release notes and assets.
gh release create \
-R ${{ github.repository }} \
--verify-tag \
--notes-file body.txt \
--title "${{ github.ref_name }}" \
"${{ github.ref_name }}" \
assets/*