Skip to content

Commit

Permalink
Normalizing paths a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaykul committed Nov 6, 2023
1 parent 604a351 commit d8e634f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 29 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Build.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 4 additions & 12 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
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
Expand All @@ -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] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
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/

0 comments on commit d8e634f

Please sign in to comment.