Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Set lockfile/wheel locations into env manually
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Jan 4, 2024
1 parent f69b1d5 commit af3321d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
env:
# The target python version, which must match the Dockerfile version
CONTAINER_PYTHON: "3.11"
DIST_LOCKFILE_PATH: lockfiles-${{env.CONTAINER_PYTHON}}-dist-${{ github.sha }}

jobs:
lint:
Expand Down Expand Up @@ -84,6 +83,11 @@ jobs:
# Need this to get version number from last tag
fetch-depth: 0

- name: Set artifact locations in environment
run: |
echo "DIST_LOCKFILE_PATH=lockfiles-${{ env.CONTAINER_PYTHON }}-dist-${{ github.sha }}" >> $GITHUB_ENV
echo "DIST_WHEEL_PATH=dist-${{ github.sha }}" >> $GITHUB_ENV
- name: Build sdist and wheel
run: |
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) && \
Expand All @@ -92,7 +96,7 @@ jobs:
- name: Upload sdist and wheel as artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.sha }}
name: ${{ env.DIST_WHEEL_PATH }}
path: dist

- name: Check for packaging errors
Expand Down Expand Up @@ -153,7 +157,7 @@ jobs:
# step and the later build-push-action, otherwise the second build-push-action
# will attempt to build the image again
build-args: |
PIP_OPTIONS=-r ${{env.DIST_LOCKFILE_PATH}}/requirements.txt dist-${{ github.sha }}/*.whl
PIP_OPTIONS=-r ${{ env.DIST_LOCKFILE_PATH }}/requirements.txt ${{ env.DIST_WHEEL_PATH }}/*.whl
context: artifacts/
file: ./Dockerfile
target: runtime
Expand Down Expand Up @@ -190,7 +194,7 @@ jobs:
# step and the previous build-push-action, otherwise this step will
# attempt to build the image again
build-args: |
PIP_OPTIONS=-r ${{env.DIST_LOCKFILE_PATH}}/requirements.txt dist-${{ github.sha }}/*.whl
PIP_OPTIONS=-r ${{ env.DIST_LOCKFILE_PATH }}/requirements.txt ${{ env.DIST_WHEEL_PATH }}/*.whl
context: artifacts/
file: ./Dockerfile
target: runtime
Expand All @@ -211,7 +215,7 @@ jobs:

- name: Fixup blank lockfiles
# Github release artifacts can't be blank
run: for f in ${{env.DIST_LOCKFILE_PATH}}/*; do [ -s $f ] || echo '# No requirements' >> $f; done
run: for f in ${{ env.DIST_LOCKFILE_PATH }}/*; do [ -s $f ] || echo '# No requirements' >> $f; done

- name: Github Release
# We pin to the SHA, not the tag, for security reasons.
Expand All @@ -220,8 +224,8 @@ jobs:
with:
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
files: |
dist-${{ github.sha }}/*
${{env.DIST_LOCKFILE_PATH}}/*
${{ env.DIST_WHEEL_PATH }}/*
${{ env.DIST_LOCKFILE_PATH }}/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit af3321d

Please sign in to comment.