Skip to content

[mukti-metadata] version 0.2.0 #29

[mukti-metadata] version 0.2.0

[mukti-metadata] version 0.2.0 #29

Workflow file for this run

# adapted from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml
name: Publish releases
on:
push:
tags:
- "*"
jobs:
mukti-metadata-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'mukti-metadata-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Install cargo release
uses: baptiste0928/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 # v1
with:
crate: cargo-release
# Version 0.21.4 has the idempotency behavior we want, until
# https://github.com/crate-ci/cargo-release/issues/594 is addressed.
version: =0.21.4
locked: true
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
with:
prefix: mukti-metadata
changelog: mukti-metadata/CHANGELOG.md
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./scripts/cargo-release-publish.sh --exclude mukti-bin
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
create-mukti-bin-release:
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'mukti-bin-')
runs-on: ubuntu-18.04 # TODO: use ubuntu-latest + a musl build or cargo-zigbuild
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
with:
prefix: mukti-bin
title: $prefix $version
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version number
id: get-version-number
run: |
TAG_NAME=${{ github.ref_name }}
VERSION=${TAG_NAME#"mukti-bin-"}
echo "The version number is $VERSION"
echo "::set-output name=version::$VERSION"
outputs:
version: ${{ steps.get-version-number.outputs.version }}
upload-mukti-bin-assets:
name: Publish for ${{ matrix.target }}
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'mukti-bin-')
needs:
- create-mukti-bin-release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-18.04
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Install Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1
with:
toolchain: stable
profile: minimal
override: true
- uses: taiki-e/upload-rust-binary-action@272c412055d610c1b1adf56e9f238aa88c5ebf45 # v1
with:
bin: mukti-bin
archive: $tag-$target
target: ${{ matrix.target }}
tar: all
zip: windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set archive output variable
id: archive-output
shell: bash
run: |
if [[ ${{ matrix.target }} == "x86_64-pc-windows-msvc" ]]; then
echo "::set-output name=${{ matrix.target }}-zip::${{ github.ref_name }}-${{ matrix.target }}.zip"
else
echo "::set-output name=${{ matrix.target }}-tar-gz::${{ github.ref_name }}-${{ matrix.target }}.tar.gz"
fi
outputs:
linux-tar-gz: ${{ steps.archive-output.outputs.x86_64-unknown-linux-gnu-tar-gz }}
windows-tar-gz: ${{ steps.archive-output.outputs.x86_64-pc-windows-msvc-tar-gz }}
windows-zip: ${{ steps.archive-output.outputs.x86_64-pc-windows-msvc-zip }}
update-mukti-bin-release-meta:
name: Update release-meta branch
concurrency: ci-${{ github.ref }}
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'mukti-bin-')
needs:
- create-mukti-bin-release
- upload-mukti-bin-assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Fetch mukti assets and update .releases.json
run: |
ARCHIVE_PREFIX="https://github.com/nextest-rs/mukti/releases/download/${{ github.ref_name }}"
mkdir -p ~/bin
curl -LsSf "$ARCHIVE_PREFIX/${{ needs.upload-mukti-bin-assets.outputs.linux-tar-gz }}" | tar xzf - -C ~/bin
~/bin/mukti-bin add-release --version ${{ needs.create-mukti-bin-release.outputs.version }} \
--release-url "https://github.com/nextest-rs/mukti/releases/${{ github.ref_name }}" \
--archive-prefix "$ARCHIVE_PREFIX" \
--archive x86_64-unknown-linux-gnu:tar.gz=${{ needs.upload-mukti-bin-assets.outputs.linux-tar-gz }} \
--archive x86_64-pc-windows-msvc:tar.gz=${{ needs.upload-mukti-bin-assets.outputs.windows-tar-gz }} \
--archive x86_64-pc-windows-msvc:zip=${{ needs.upload-mukti-bin-assets.outputs.windows-zip }}
- name: Generate netlify redirects
run: |
mkdir out-dir
~/bin/mukti-bin generate-netlify out-dir --alias linux=x86_64-unknown-linux-gnu:tar.gz --alias windows=x86_64-pc-windows-msvc:zip
- name: Update releases.json on main branch
uses: EndBug/add-and-commit@72e246094f1af94def5a07467cd789c503ae8be0 # v8
with:
add: .releases.json
message: "Update release metadata for ${{ github.ref_name }}"
default_author: github_actions
# Need to specify pull and push arguments because we're checked out to a tag here (i.e. not on a branch)
pull: "--rebase --autostash origin main"
push: "origin HEAD:main"
- name: Copy releases.json to output dir
run: |
cp .releases.json out-dir/releases.json
- name: Deploy release metadata
uses: JamesIves/github-pages-deploy-action@a1ea191d508feb8485aceba848389d49f80ca2dc # v4
with:
branch: release-meta
folder: out-dir