Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@ jobs:
${{ github.workspace }}/*.tgz
${{ github.workspace }}/dist/craft
${{ github.workspace }}/gh-pages.zip
if-no-files-found: ignore
72 changes: 64 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ inputs:
description: Use the craft config from the merge target branch
required: false
default: "false"
craft_version:
description: >
Version of Craft to install (tag or "latest").
Defaults to the action ref (e.g., "v2") if not specified.
required: false
default: ""

outputs:
version:
Expand Down Expand Up @@ -83,16 +89,66 @@ runs:
echo "GIT_AUTHOR_NAME=${GIT_USER_NAME}" >> $GITHUB_ENV
echo "EMAIL=${GIT_USER_EMAIL}" >> $GITHUB_ENV

# For dogfooding (Craft releasing itself) - local path works because
# the checkout is in the Craft repo, so ./install resolves correctly
- name: Install Craft (local)
# === Install Craft ===
# For dogfooding (getsentry/craft): try build artifact from build job
# For all repos (or if artifact unavailable): download from release

- name: Download Craft from build artifact
id: craft-artifact
if: github.repository == 'getsentry/craft'
uses: ./install
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ github.sha }}
path: /tmp/craft-artifact

# For external repos - use fully-qualified reference with action ref
- name: Install Craft
if: github.repository != 'getsentry/craft'
uses: getsentry/craft/install@${{ github.action_ref }}
- name: Install Craft from artifact or release
shell: bash
run: |
set -euo pipefail

if [[ -f /tmp/craft-artifact/dist/craft ]]; then
echo "Installing Craft from build artifact..."
sudo install -m 755 /tmp/craft-artifact/dist/craft /usr/local/bin/craft
else
# Download from release (for external repos or if artifact unavailable)
# Use explicit craft_version input if provided, otherwise fall back to github.action_ref
CRAFT_VERSION="${{ inputs.craft_version }}"
if [[ -z "$CRAFT_VERSION" ]]; then
CRAFT_VERSION="${{ github.action_ref }}"
fi

if [[ "$CRAFT_VERSION" == "latest" || -z "$CRAFT_VERSION" ]]; then
echo "Downloading latest Craft release..."
CRAFT_URL=$(curl -fsSL "https://api.github.com/repos/getsentry/craft/releases/latest" \
| jq -r '.assets[] | select(.name == "craft") | .browser_download_url')
else
CRAFT_URL="https://github.com/getsentry/craft/releases/download/${CRAFT_VERSION}/craft"
echo "Downloading Craft ${CRAFT_VERSION} from: ${CRAFT_URL}"

# Fallback to latest if specified version doesn't have a release
if ! curl -sfI "$CRAFT_URL" >/dev/null 2>&1; then
echo "Release not found for version '${CRAFT_VERSION}', falling back to latest..."
CRAFT_URL=$(curl -fsSL "https://api.github.com/repos/getsentry/craft/releases/latest" \
| jq -r '.assets[] | select(.name == "craft") | .browser_download_url')
fi
fi

# Verify we have a valid URL
if [[ -z "$CRAFT_URL" ]]; then
echo "::error::Failed to determine Craft download URL. The GitHub API may have failed or the release asset is missing."
exit 1
fi

echo "Installing Craft from: ${CRAFT_URL}"
sudo curl -fsSL -o /usr/local/bin/craft "$CRAFT_URL"
sudo chmod +x /usr/local/bin/craft

# Verify the binary was downloaded successfully
if [[ ! -s /usr/local/bin/craft ]]; then
echo "::error::Downloaded Craft binary is empty or missing"
exit 1
fi
fi

- name: Craft Prepare
id: craft
Expand Down
83 changes: 0 additions & 83 deletions install/action.yml

This file was deleted.

Loading