ci: do not pass tokens to goreleaser on dry release runs #3
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 | |
on: | |
push: | |
branches: | |
- ci/* | |
- release/* | |
tags: | |
- v* | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
# This enables the workflow to create GitHub releases | |
contents: write | |
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: | |
submodules: 'recursive' | |
- uses: ./.github/actions/export-circle-env | |
- uses: ./.github/actions/install-system-dependencies | |
- uses: ./.github/actions/install-go | |
- env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: make deps lotus lotus-miner lotus-worker | |
- if: runner.os == 'macOS' | |
run: otool -hv lotus | |
- run: ./scripts/version-check.sh ./lotus | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: lotus-${{ matrix.os }}-${{ matrix.arch }} | |
path: | | |
lotus | |
lotus-miner | |
lotus-worker | |
release: | |
name: Release [publish=${{ startsWith(github.ref, 'refs/tags/') }}] | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
# Do not publish until CircleCI is deprecated | |
PUBLISH: false | |
# PUBLISH: ${{ startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- 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: ./.github/actions/export-circle-env | |
- uses: ./.github/actions/install-go | |
- 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: latest | |
args: release --clean --debug ${{ env.PUBLISH == 'false' && '--snapshot' || '' }} | |
env: | |
GITHUB_TOKEN: ${{ env.PUBLISH == 'true' && github.token || '' }} | |
GORELEASER_KEY: ${{ env.PUBLISH == 'true' && secrets.GORELEASER_KEY || '' }} | |
- run: ./scripts/generate-checksums.sh | |
- if: env.PUBLISH == 'true' | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: ./scripts/publish-checksums.sh |