Release #70
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: Release | |
# TODO(p2): Restore worfklow_dispatch trigger | |
on: | |
push: | |
branches: | |
- ipdx/release-automation-release-v* | |
- ipdx/release-automation-releases | |
paths: | |
- build/version.go | |
pull_request: | |
branches: | |
- ipdx/release-automation-release-v* | |
- ipdx/release-automation-releases | |
paths: | |
- build/version.go | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish the release' | |
required: false | |
default: 'false' | |
draft: | |
description: 'Create a draft release' | |
required: false | |
default: 'true' | |
target_commitish: | |
description: 'The commitish value that determines where the Git tag is created from' | |
required: false | |
default: '' | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
check: | |
name: Check which projects need to be built | |
runs-on: ubuntu-latest | |
outputs: | |
projects: ${{ steps.projects.outputs.projects }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: projects | |
env: | |
TARGET_REF: ${{ github.base_ref || github.ref }} | |
run: | | |
go run cmd/release/main.go --json list-projects | jq -r '.msg' | | |
jq 'map(select(.version | endswith("-dev") | not))' | | |
jq 'map(select(.released | not))' | | |
jq 'map(select(.prerelease != (env.TARGET_REF == "refs/heads/ipdx/release-automation-releases")))' | | |
jq -c '.' | xargs -I {} -0 echo "projects={}" | | |
tee -a $GITHUB_OUTPUT | |
build: | |
needs: [check] | |
if: needs.check.outputs.projects != '[]' | |
name: Build ${{ matrix.project }} (${{ matrix.runner }}) | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
project: ${{ fromJSON(needs.check.outputs.projects).*.name }} | |
runner: | |
- ubuntu-latest # Linux X64 | |
- macos-13 # MacOs X64 | |
- macos-14 # MacOS ARM64 | |
steps: | |
- run: echo "Building on $RUNNER_OS/$RUNNER_ARCH" | |
- id: project | |
env: | |
projects: ${{ needs.check.outputs.projects }} | |
name: ${{ matrix.project }} | |
run: | | |
jq -nc 'env.projects | fromjson | map(select(.name == env.name)) | .[0]' | | |
xargs -I {} -0 echo "config={}" | | |
tee -a $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- uses: ./.github/actions/install-system-dependencies | |
- uses: ./.github/actions/install-go | |
- env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: make deps | |
- if: matrix.project == 'node' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: make lotus | |
- if: matrix.project == 'miner' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: make lotus-miner lotus-worker | |
- if: runner.os == 'macOS' | |
run: if [[ -f lotus ]]; then otool -hv lotus; fi | |
- env: | |
LOTUS_VERSION_IGNORE_COMMIT: 1 | |
expected: ${{ fromJSON(steps.project.outputs.config).version }} | |
run: | | |
for bin in lotus lotus-miner lotus-worker; do | |
if [[ -f ./$bin ]]; then | |
chmod +x ./$bin | |
actual=$(./$bin --version | cut -d' ' -f3) | |
if [[ "$actual" != "$expected" ]]; then | |
echo "::error title=Version Mismatch::Expected $expected, got $actual (./$bin)" | |
exit 1 | |
fi | |
fi | |
done | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: lotus-${{ matrix.project }}-${{ runner.os }}-${{ runner.arch }} | |
path: | | |
lotus | |
lotus-miner | |
lotus-worker | |
release: | |
needs: [check, build] | |
if: needs.check.outputs.projects != '[]' | |
name: Release ${{ matrix.project }} [publish=${{ inputs.publish || github.event_name != 'pull_request' }}] | |
permissions: | |
# This enables the job to create and/or update GitHub releases | |
contents: write | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
project: ${{ fromJSON(needs.check.outputs.projects).*.name }} | |
env: | |
PUBLISH: ${{ inputs.publish || github.event_name != 'pull_request' }} | |
steps: | |
- id: project | |
env: | |
projects: ${{ needs.check.outputs.projects }} | |
name: ${{ matrix.project }} | |
run: | | |
jq -nc 'env.projects | fromjson | map(select(.name == env.name)) | .[0]' | | |
xargs -I {} -0 echo "config={}" | | |
tee -a $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lotus-${{ matrix.project }}-Linux-X64 | |
path: linux_amd64_v1 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lotus-${{ matrix.project }}-macOS-X64 | |
path: darwin_amd64_v1 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: lotus-${{ matrix.project }}-macOS-ARM64 | |
path: darwin_arm64 | |
- uses: ./.github/actions/install-go | |
- uses: ipfs/download-ipfs-distribution-action@v1 | |
with: | |
name: kubo | |
version: v0.16.0 | |
- name: Install yq | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release --repo mikefarah/yq download v4.44.2 -p yq_linux_amd64 | |
sudo mv yq_linux_amd64 /usr/bin/yq | |
sudo chmod +x /usr/bin/yq | |
# - if: inputs.draft || github.event_name != 'pull_request' | |
# run: yq -i '.release.draft = false' '.goreleaser.yaml' | |
# - if: (inputs.publish || github.event_name != 'pull_request') && fromJSON(steps.project.outputs.config).latest && !fromJSON(steps.project.outputs.config).prerelease | |
# run: yq -i '.brews.[0].skip_upload = false' '.goreleaser.yaml' | |
- if: matrix.project == 'node' | |
env: | |
BREW_INSTALL: | | |
bin.install "lotus" | |
BREW_TEST: | | |
system "#{bin}/lotus --version" | |
run: | | |
yq -i '(.builds[] | select(.id == "lotus")).skip = false' '.goreleaser.yaml' | |
yq -i '.brews[0].install = strenv(BREW_INSTALL)' '.goreleaser.yaml' | |
yq -i '.brews[0].test = strenv(BREW_TEST)' '.goreleaser.yaml' | |
- if: matrix.project == 'miner' | |
env: | |
BREW_INSTALL: | | |
bin.install "lotus-miner" | |
bin.install "lotus-worker" | |
BREW_TEST: | | |
system "#{bin}/lotus-miner --version" | |
system "#{bin}/lotus-worker --version" | |
run: | | |
yq -i '(.builds[] | select(.id == "lotus-miner" or .id == "lotus-worker")).skip = false' '.goreleaser.yaml' | |
yq -i '.brews[0].install = strenv(BREW_INSTALL)' '.goreleaser.yaml' | |
yq -i '.brews[0].test = strenv(BREW_TEST)' '.goreleaser.yaml' | |
- uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 | |
with: | |
distribution: goreleaser-pro | |
version: 2.0.1 | |
args: release --clean --skip=validate ${{ env.PUBLISH == 'false' && '--snapshot' || '' }} | |
env: | |
PROJECT_NAME: ${{ matrix.project == 'node' && 'lotus' || format('lotus-{0}', matrix.project) }} | |
GITHUB_TOKEN: ${{ env.PUBLISH == 'true' && (secrets.GORELEASER_GITHUB_TOKEN || github.token) || '' }} | |
GORELEASER_KEY: ${{ env.PUBLISH == 'true' && secrets.GORELEASER_KEY || '' }} | |
TAG: ${{ fromJSON(steps.project.outputs.config).tag }} | |
VERSION: ${{ fromJSON(steps.project.outputs.config).version }} | |
IS_LATEST: ${{ fromJSON(steps.project.outputs.config).latest }} | |
IS_PRERELEASE: ${{ fromJSON(steps.project.outputs.config).prerelease }} | |
TARGET_COMMITISH: ${{ inputs.target_commitish || (github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.sha) }} | |
HEADER: '' # TODO(p3): Extract release notes from CHANGELOG.md | |
- run: ./scripts/generate-checksums.sh | |
- if: env.PUBLISH == 'true' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
TAG: ${{ fromJSON(steps.project.outputs.config).tag }} | |
run: ./scripts/publish-checksums.sh |