Cutting release 0.3.3 #36
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
# This is the release job for `mpdpopm`. It will create the Github | |
# release itself as well as upload several artifacts. | |
# Much thanks to BurntShushi from whom I shamelessly copied a lot of | |
# this | |
# <https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml> | |
name: Release | |
on: | |
# This permits this workflow to be triggered manually. See the | |
# environment variable RELEASE_VERSION below, however. | |
workflow_dispatch: | |
# Modifying the push event with 'branches' and 'tags' seems to be an | |
# OR operation (i.e. the workflow will run if either on branch | |
# release-infra *or* it has a tag of n.n.n) | |
push: | |
# Un-comment this for testing | |
# branches: | |
# - fix-release-gha-2023-07-22 | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
# This job will create the GitHub release | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
# Un-comment this for testing | |
# env: | |
# RELEASE_VERSION: 0.3.1 | |
steps: | |
- name: Create artifacts directory | |
run: mkdir artifacts | |
- name: Get the release version from the tag | |
if: env.RELEASE_VERSION == '' | |
run: | | |
# https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
echo "version is: ${{ env.RELEASE_VERSION }}" | |
- name: Create GitHub release | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: ${{ env.RELEASE_VERSION }} | |
- name: Save release upload URL to artifact | |
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | |
- name: Save version number to artifact | |
run: echo "${{ env.RELEASE_VERSION }}" > artifacts/release-version | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: artifacts | |
path: artifacts | |
# This job will actually create the artifacts I want to include with the release | |
build-release: | |
name: build-release | |
needs: ['create-release'] | |
runs-on: ${{ matrix.os }} | |
env: | |
RUST_BACKTRACE: 1 | |
strategy: | |
matrix: | |
build: [linux, macos] | |
include: | |
- build: linux | |
os: ubuntu-22.04 | |
rust: stable | |
target: x86_64-unknown-linux | |
- build: macos | |
os: macos-12 | |
rust: stable | |
target: x86_64-apple-darwin | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Install Tools (Ubuntu) | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
pwd | |
set -x | |
set -e | |
sudo apt-get update | |
sudo apt-get install -y autoconf automake emacs liblzma-dev texlive | |
- name: Install Tools (macOS) | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
set -x | |
# This seems wrong on multiple levels, but see here: | |
# <https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6339258> | |
set +e | |
pwd | |
brew cleanup | |
# Will exit with non-zero status if it finds problems, but can be handy | |
# for trouble-shooting: | |
brew doctor | |
brew update | |
brew upgrade | |
set -e | |
brew install autoconf automake emacs | |
brew install --cask basictex | |
- name: Install a modern version of Texinfo | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
set -x | |
mkdir tmp && cd tmp | |
# TODO(sp1ff): cache this | |
curl -L -O https://ftp.gnu.org/gnu/texinfo/texinfo-7.0.2.tar.gz | |
tar xf texinfo-7.0.2.tar.gz | |
cd texinfo-7.0.2 | |
./configure | |
make | |
make install | |
type -p texi2dvi | |
texi2dvi --version | |
- name: Install additional Rust tooling | |
shell: bash | |
run: | | |
cargo install cargo-deb | |
- name: Configure mpdpopm | |
shell: bash | |
run: | | |
set -x | |
./bootstrap && ./configure | |
- name: Get release download URL | |
uses: actions/download-artifact@v1 | |
with: | |
name: artifacts | |
path: artifacts | |
- name: Set release upload URL and release version | |
shell: bash | |
run: | | |
release_upload_url="$(cat artifacts/release-upload-url)" | |
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV | |
echo "release upload url: $RELEASE_UPLOAD_URL" | |
release_version="$(cat artifacts/release-version)" | |
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | |
echo "release version: $RELEASE_VERSION" | |
- name: Build mpdpopm | |
run: | | |
make all dist | |
echo "DISTRO_GZ=mpdpopm-${{ env.RELEASE_VERSION }}.tar.gz" >> $GITHUB_ENV | |
echo "DISTRO_XZ=mpdpopm-${{ env.RELEASE_VERSION }}.tar.xz" >> $GITHUB_ENV | |
echo "DISTRO_ZST=mpdpopm-${{ env.RELEASE_VERSION }}.tar.zst" >> $GITHUB_ENV | |
- name: Strip release binary (linux and macos) | |
if: matrix.build == 'linux' || matrix.build == 'macos' | |
shell: bash | |
run: | | |
cd mpdpopm | |
strip target/release/mppopmd | |
strip target/release/mppopm | |
- name: Build archive | |
shell: bash | |
run: | | |
set -x | |
pwd | |
ls mpdpopm | |
staging="mpdpopm-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" | |
mkdir -p "$staging"/{bin,doc} | |
cp -v {README.org,AUTHORS,ChangeLog,COPYING,NEWS,THANKS} "$staging/doc/" | |
cp -v mpdpopm/mppopmd.{conf,service} "$staging/doc/" | |
cp -v doc/mpdpopm.info "$staging/doc/" | |
cp -v mpdpopm/target/release/mppopm{,d} "$staging/bin/" | |
tar czf "$staging.tar.gz" "$staging" | |
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | |
- name: Upload release archive | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: ${{ env.ASSET }} | |
asset_name: ${{ env.ASSET }} | |
asset_content_type: application/octet-stream | |
- name: Upload gzip tarball | |
if: matrix.os == 'ubuntu-22.04' | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: ${{ env.DISTRO_GZ }} | |
asset_name: ${{ env.DISTRO_GZ }} | |
asset_content_type: application/octet-stream | |
- name: Upload xzip tarball | |
if: matrix.os == 'ubuntu-22.04' | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: ${{ env.DISTRO_XZ }} | |
asset_name: ${{ env.DISTRO_XZ }} | |
asset_content_type: application/octet-stream | |
- name: Upload zst tarball | |
if: matrix.os == 'ubuntu-22.04' | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: ${{ env.DISTRO_ZST }} | |
asset_name: ${{ env.DISTRO_ZST }} | |
asset_content_type: application/octet-stream | |
- name: Make Debian package | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
# You would think I can deduce the name of the package from | |
# RELEASE_VERSION, but Debian uses different designators for | |
# architecture (amd64 instead of x86_64, e.g.) than those | |
# produced by `uname'. Since there will only be one .deb in the | |
# output directory, I'll just figure it out that way. | |
run: | | |
set -x | |
cd mpdpopm | |
cargo deb | |
echo "DEBIAN_PKG=$(cd target/debian && ls *.deb)" >> $GITHUB_ENV | |
- name: Upload Debian package | |
if: matrix.os == 'ubuntu-22.04' | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | |
asset_path: mpdpopm/target/debian/${{ env.DEBIAN_PKG }} | |
asset_name: ${{ env.DEBIAN_PKG }} | |
asset_content_type: application/octet-stream |