wip: fix #4
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
on: | ||
workflow_call: | ||
inputs: | ||
forge_version: | ||
description: | | ||
The version of the forge CLI to install (use 'local' for testing) | ||
type: string | ||
required: false | ||
default: latest | ||
secrets: | ||
earthly_token: | ||
description: Optional Earthly token used to login to Earthly cloud during local builds of Forge CLI | ||
required: false | ||
env: | ||
FORGE_REGEX_CHECK: ^check(-.*)?$ | ||
FORGE_REGEX_BUILD: ^build(-.*)?$ | ||
FORGE_REGEX_PACKAGE: ^package(-.*)?$ | ||
FORGE_REGEX_TEST: ^test(-.*)?$ | ||
FORGE_REGEX_DOCS: ^docs(-.*)?$ | ||
FORGE_REGEX_RELEASE: ^release(-.*)?$ | ||
FORGE_REGEX_PUBLISH: ^publish(-.*)?$ | ||
jobs: | ||
discover: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
deployments: ${{ steps.discovery.outputs.deployments }} | ||
earthfiles: ${{ steps.discovery.outputs.earthfiles }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Forge | ||
uses: input-output-hk/catalyst-forge/actions/install@ci/v1.1.0 | ||
if: ${{ inputs.forge_version != 'local' }} | ||
with: | ||
version: ${{ inputs.forge_version }} | ||
- name: Install Local Forge | ||
uses: input-output-hk/catalyst-forge/actions/install-local@ci/v1.1.0 | ||
if: ${{ inputs.forge_version == 'local' }} | ||
with: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
- name: Check forge version | ||
id: local | ||
run: | | ||
forge version | ||
if [[ "${{ inputs.forge_version }}" == "local" ]]; then | ||
echo "skip=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "skip=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Setup CI | ||
uses: input-output-hk/catalyst-forge/actions/setup@ci/v1.1.0 | ||
with: | ||
skip_docker: 'true' | ||
skip_github: 'true' | ||
skip_earthly: ${{ steps.local.outputs.skip }} | ||
- name: Discovery | ||
id: discovery | ||
uses: input-output-hk/catalyst-forge/actions/discovery@ci/v1.1.0 | ||
with: | ||
filters: | | ||
${{ env.FORGE_REGEX_CHECK }} | ||
${{ env.FORGE_REGEX_BUILD }} | ||
${{ env.FORGE_REGEX_PACKAGE }} | ||
${{ env.FORGE_REGEX_TEST }} | ||
${{ env.FORGE_REGEX_DOCS }} | ||
${{ env.FORGE_REGEX_RELEASE }} | ||
${{ env.FORGE_REGEX_PUBLISH }} | ||
check: | ||
uses: ./.github/workflows/run.yml@ci/v1.1.0 | ||
needs: [discover] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^check(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^check(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
build: | ||
uses: ./.github/workflows/run.yml@ci/v1.1.0 | ||
needs: [discover, check] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^build(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^build(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
package: | ||
uses: ./.github/workflows/run.yml@ci/v1.1.0 | ||
needs: [discover, check, build] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^package(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^package(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
test: | ||
uses: ./.github/workflows/run.yml@ci/v1.1.0 | ||
needs: [discover, check, build, package] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^test(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^test(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
docs: | ||
uses: ./.github/workflows/docs.yml@ci/v1.1.0 | ||
needs: [discover, check, build, test] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^docs(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^docs(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
publish: | ||
uses: ./.github/workflows/publish.yml@ci/v1.1.0 | ||
needs: [discover, check, build, test] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^publish(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^publish(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
deploy: | ||
uses: ./.github/workflows/deploy.yml@ci/v1.1.0 | ||
needs: [discover, check, build, test, publish] | ||
if: (fromJson(needs.discover.outputs.deployments)[0] != null) && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && !failure() && !cancelled() | ||
with: | ||
deployments: ${{ needs.discover.outputs.deployments }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
release: | ||
uses: ./.github/workflows/release.yml@ci/v1.1.0 | ||
needs: [discover, check, build, test] | ||
if: (fromJson(needs.discover.outputs.earthfiles)['^release(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^release(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
final: | ||
needs: [check, build, package, test, publish, release] | ||
if: (!failure() && !cancelled()) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Final | ||
run: echo "All done" |