Merge pull request #12147 from filecoin-project/chore/nv23-v1.28.0-ba… #56
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 | |
on: | |
push: | |
branches: | |
- ci/* | |
- release/* | |
tags: | |
- v* | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: The GitHub ref (e.g. refs/tags/v1.0.0) to release | |
required: false | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build (${{ matrix.os }}/${{ matrix.arch }}) | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: ubuntu-latest | |
os: Linux | |
arch: X64 | |
- runner: macos-13 | |
os: macOS | |
arch: X64 | |
- runner: macos-14 | |
os: macOS | |
arch: ARM64 | |
steps: | |
- env: | |
OS: ${{ matrix.os }} | |
ARCH: ${{ matrix.arch }} | |
run: | | |
if [[ "$OS" != "$RUNNER_OS" || "$ARCH" != "$RUNNER_ARCH" ]]; then | |
echo "::error title=Unexpected Runner::Expected $OS/$ARCH, got $RUNNER_OS/$RUNNER_ARCH" | |
exit 1 | |
fi | |
- uses: actions/checkout@v4 | |
with: | |
path: actions | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
ref: ${{ inputs.ref || github.ref }} | |
path: lotus | |
- uses: ./actions/.github/actions/install-system-dependencies | |
- uses: ./actions/.github/actions/install-go | |
with: | |
working-directory: lotus | |
- env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: make deps lotus lotus-miner lotus-worker | |
working-directory: lotus | |
- if: runner.os == 'macOS' | |
run: otool -hv lotus | |
working-directory: lotus | |
- env: | |
INPUTS_REF: ${{ inputs.ref }} | |
run: | | |
export GITHUB_REF=${INPUTS_REF:-$GITHUB_REF} | |
../actions/scripts/version-check.sh ./lotus | |
working-directory: lotus | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: lotus-${{ matrix.os }}-${{ matrix.arch }} | |
path: | | |
lotus/lotus | |
lotus/lotus-miner | |
lotus/lotus-worker | |
release: | |
name: Release [publish=${{ startsWith(inputs.ref || github.ref, 'refs/tags/') }}] | |
permissions: | |
# This enables the job to create and/or update GitHub releases | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
PUBLISH: ${{ startsWith(inputs.ref || github.ref, 'refs/tags/') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: actions | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
path: lotus | |
ref: ${{ inputs.ref || github.ref }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lotus-Linux-X64 | |
path: linux_amd64_v1 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lotus-macOS-X64 | |
path: darwin_amd64_v1 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lotus-macOS-ARM64 | |
path: darwin_arm64 | |
- uses: ./actions/.github/actions/install-go | |
with: | |
working-directory: lotus | |
- uses: ipfs/download-ipfs-distribution-action@v1 | |
with: | |
name: kubo | |
version: v0.16.0 | |
- uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 | |
with: | |
distribution: goreleaser-pro | |
version: 2.0.1 | |
args: release --clean ${{ env.PUBLISH == 'false' && '--snapshot' || '' }} | |
workdir: lotus | |
env: | |
GITHUB_TOKEN: ${{ env.PUBLISH == 'true' && secrets.GORELEASER_GITUB_TOKEN || github.token || '' }} | |
GORELEASER_KEY: ${{ env.PUBLISH == 'true' && secrets.GORELEASER_KEY || '' }} | |
- env: | |
INPUTS_REF: ${{ inputs.ref }} | |
run: | | |
export GITHUB_REF=${INPUTS_REF:-$GITHUB_REF} | |
../actions/scripts/generate-checksums.sh | |
working-directory: lotus | |
- if: env.PUBLISH == 'true' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
INPUTS_REF: ${{ inputs.ref }} | |
run: | | |
export GITHUB_REF=${INPUTS_REF:-$GITHUB_REF} | |
../actions/scripts/publish-checksums.sh | |
working-directory: lotus |