Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
69 changes: 67 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,73 @@ jobs:
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}

build-windows:
needs: version
runs-on: windows-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
base-image:
- mcr.microsoft.com/windows/servercore:ltsc2022
steps:
- name: Checkout source
uses: actions/checkout@v4
Comment thread
pavelzw marked this conversation as resolved.
Outdated

- name: Set image variables
id: image-variables
run: |
$baseImage = "${{ matrix.base-image }}"
$tag = if ($baseImage -like "*nanoserver*") { "nanoserver" } else { "servercore" }
Comment thread
pavelzw marked this conversation as resolved.
echo "tag=$tag" >> $env:GITHUB_OUTPUT
shell: pwsh

- name: Login to GHCR
uses: docker/login-action@v3
Comment thread
jamesfricker marked this conversation as resolved.
Outdated
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
Comment thread
pavelzw marked this conversation as resolved.
Outdated
env:
PIXI_VERSION: ${{ needs.version.outputs.new-version }}
run: |
$baseImage = "${{ matrix.base-image }}"
$tag = "${{ steps.image-variables.outputs.tag }}"

# Build the image
docker build `
--build-arg PIXI_VERSION=$env:PIXI_VERSION `
--build-arg BASE_IMAGE=$baseImage `
-t ghcr.io/prefix-dev/pixi:$env:PIXI_VERSION-$tag `
-f Dockerfile.windows .

# Push the image if this is a version change on the main branch
if ('${{ needs.version.outputs.push }}' -eq 'true') {
docker push ghcr.io/prefix-dev/pixi:$env:PIXI_VERSION-$tag
}
Comment thread
jamesfricker marked this conversation as resolved.
Outdated
shell: pwsh


- name: Run tests
if: needs.version.outputs.push == 'true'
Comment thread
pavelzw marked this conversation as resolved.
Outdated
run: |
$tag = "${{ steps.image-variables.outputs.tag }}"
$version = "${{ needs.version.outputs.new-version }}"

Comment thread
pavelzw marked this conversation as resolved.
Outdated
docker run --rm ghcr.io/prefix-dev/pixi:${version}-${tag} pixi --version
docker run --rm ghcr.io/prefix-dev/pixi:${version}-${tag} powershell -Command "mkdir C:\app; cd C:\app; pixi init; pixi add python; pixi run python --version"
shell: pwsh

- name: Image digest
run: docker inspect ghcr.io/prefix-dev/pixi:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} --format '{{.RepoDigests}}'
shell: pwsh

release:
needs: [version, build]
needs: [version, build, build-windows]
runs-on: ubuntu-22.04
permissions:
contents: write
Expand All @@ -162,4 +227,4 @@ jobs:
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
tag_name: ${{ needs.version.outputs.new-version }}
tag_name: ${{ needs.version.outputs.new-version }}
Comment thread
jamesfricker marked this conversation as resolved.
13 changes: 13 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# escape=`

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ARG PIXI_VERSION

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
Comment thread
jamesfricker marked this conversation as resolved.
Outdated

RUN Invoke-WebRequest -Uri "https://github.com/prefix-dev/pixi/releases/download/v${env:PIXI_VERSION}/pixi-x86_64-pc-windows-msvc.exe" -OutFile C:\Windows\System32\pixi.exe
Comment thread
jamesfricker marked this conversation as resolved.
Outdated

RUN pixi --version

Comment thread
jamesfricker marked this conversation as resolved.