Build and release artifacts #21
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: Build and release artifacts | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
permissions: | |
contents: write | |
jobs: | |
prepare: | |
name: Prepare release | |
runs-on: ubuntu-latest | |
outputs: | |
tag_name: ${{ steps.release_info.outputs.tag_name }} | |
release_name: ${{ steps.release_info.outputs.release_name }} | |
steps: | |
# If it's a nightly release, tag with the release time. If the tag is `main`, we want to use | |
# `latest` as the tag name. Else, use the tag name as is. | |
- name: Compute release name and tag | |
id: release_info | |
run: | | |
# IS_NIGHTLY is currently unused | |
if [[ $IS_NIGHTLY ]]; then | |
echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT | |
echo "release_name=Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT | |
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then | |
echo "tag_name=latest" >> $GITHUB_OUTPUT | |
echo "release_name=Latest Release" >> $GITHUB_OUTPUT | |
else | |
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
echo "release_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
fi | |
build-and-release: | |
needs: prepare | |
timeout-minutes: 120 | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
include: | |
- runner: [runs-on, runner=32cpu-linux-x64, "run-id=${{ github.run_id }}"] | |
os: ubuntu | |
- runner: [runs-on, runner=32cpu-linux-arm64, "run-id=${{ github.run_id }}"] | |
os: ubuntu | |
- runner: self-hosted | |
os: macos | |
- runner: macos-13 | |
os: macos | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
if: matrix.os == 'ubuntu' | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- uses: actions/checkout@v4 | |
- name: Install ninja and riscv-tools | |
if: matrix.os == 'ubuntu' | |
run: | | |
sudo apt update | |
sudo apt-get -y install ninja-build gcc-riscv64-unknown-elf | |
- name: Install ninja and riscv-tools | |
if: matrix.os == 'macos' | |
run: | | |
brew install ninja | |
brew tap riscv-software-src/riscv | |
brew install riscv-tools | |
- name: Download source | |
run: ./clone.sh | |
- name: Apply patches | |
run: ./patch.sh | |
- name: Build toolchain | |
run: ./build.sh | |
# Push in the Github environment variable the name of the artifact | |
- run: ./config.sh -artifact_name | |
- name: Package toolchain | |
run: ./package.sh | |
- name: Rename artifact | |
run: mv ${{ env.ARTIFACT_NAME }}.tar.gz ${{ env.ARTIFACT_NAME }}-${{ needs.prepare.outputs.tag_name }}.tar.gz | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
draft: true | |
name: ${{ needs.prepare.outputs.release_name }} | |
tag: "${{ needs.prepare.outputs.tag_name }}" | |
artifacts: "${{ env.ARTIFACT_NAME }}-${{ needs.prepare.outputs.tag_name }}.tar.gz" | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitDraftDuringUpdate: true | |
omitNameDuringUpdate: true | |
omitPrereleaseDuringUpdate: true |