diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 23fb2f8..ff971c4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,25 +15,23 @@ jobs: - uses: earthly/actions-setup@v1 with: version: v0.7.21 + - uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 - - name: Put back the git branch into git (Earthly uses it for tagging) - run: | - branch="" - if [ -n "$GITHUB_HEAD_REF" ]; then - branch="$GITHUB_HEAD_REF" - else - branch="${GITHUB_REF##*/}" - fi - git checkout -b "$branch" || true - - name: earthly +build - run: earthly +build + - name: earthly +publish + run: earthly --ci +publish + + - uses: actions/upload-artifact@v3 + with: + path: ${{github.workspace}}/../Modules/Pansies + + - uses: actions/upload-artifact@v3 + with: + path: ${{github.workspace}}/../Modules/Pansies-TestResults - - name: Upload Build Output - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: - name: output - path: ${{github.workspace}}/output + path: ${{github.workspace}}/../Modules/Pansies-Packages diff --git a/.gitignore b/.gitignore index d37c307..e15b0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ -# ignore packages (this is for nuget stuff) -packages/ # ignore output (because we put stuff there) +Modules/ output/ # Ignore version number folders (these are our intermediate "output" directories for testing) diff --git a/Build.build.ps1 b/Build.build.ps1 index 90bb2fd..1ddf749 100644 --- a/Build.build.ps1 +++ b/Build.build.ps1 @@ -41,6 +41,8 @@ $ErrorView = 'DetailedView' # The name of the module to publish $script:PSModuleName = "TerminalBlocks" +# Use Env because Earthly can override it +$Env:OUTPUT_ROOT ??= Join-Path $BuildRoot Modules $Tasks = "Tasks", "../Tasks", "../../Tasks" | Convert-Path -ErrorAction Ignore | Select-Object -First 1 Write-Information "$($PSStyle.Foreground.BrightCyan)Found shared tasks in $Tasks" -Tag "InvokeBuild" diff --git a/Earthfile b/Earthfile index 45cd86a..6641607 100644 --- a/Earthfile +++ b/Earthfile @@ -6,7 +6,7 @@ WORKDIR /project ARG --global EARTHLY_BUILD_SHA ARG --global EARTHLY_GIT_BRANCH # These are my common paths, used in my shared /Tasks repo -ARG --global OUTPUT_ROOT=/output +ARG --global OUTPUT_ROOT=/Modules ARG --global TEST_ROOT=/tests ARG --global TEMP_ROOT=/temp # These are my common build args, used in my shared /Tasks repo @@ -26,8 +26,6 @@ deps: COPY RequiredModules.psd1 . COPY *.csproj . RUN ["pwsh", "--file", "/Tasks/_Bootstrap.ps1", "-RequiredModulesPath", "RequiredModules.psd1"] - # Install-RequiredModule does not support pre-release modules - RUN ["pwsh", "--command", "Update-Module", "ModuleBuilder", "-AllowPreRelease"] build: FROM +deps @@ -37,7 +35,7 @@ build: RUN ["pwsh", "--command", "Invoke-Build", "-Task", "Build", "-File", "Build.build.ps1"] # SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] [] [AS LOCAL ] - SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./output/$MODULE_NAME + SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME test: FROM +build @@ -46,15 +44,9 @@ test: RUN ["pwsh", "--command", "Invoke-Build", "-Task", "Test", "-File", "Build.build.ps1"] # SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] [] [AS LOCAL ] - SAVE ARTIFACT $TEST_ROOT AS LOCAL ./output/tests -# runtime: -# FROM mcr.microsoft.com/dotnet/aspnet:7.0 -# WORKDIR /app -# COPY +build/output . -# ENTRYPOINT ["dotnet", "ContainerApp.WebApp.dll"] -# SAVE IMAGE --push containerapp-webapp:earthly + SAVE ARTIFACT $TEST_ROOT AS LOCAL ./Modules/$MODULE_NAME-TestResults publish: FROM +build RUN ["pwsh", "--command", "Invoke-Build", "-Task", "Publish", "-File", "Build.build.ps1", "-Verbose"] - SAVE ARTIFACT $OUTPUT_ROOT/publish AS LOCAL ./output/publish + SAVE ARTIFACT $OUTPUT_ROOT/publish/*.nupkg AS LOCAL ./Modules/$MODULE_NAME-Packages/