Skip to content

Commit

Permalink
fix: add nixpacks build and push to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Feb 19, 2024
1 parent d040e16 commit 602ba40
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,36 @@ jobs:
body: ${{ steps.changelog.outputs.clean_changelog }}
tag_name: ${{ steps.changelog.outputs.tag }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
# gh secret set GH_PERSONAL_TOKEN --app actions --body ghp_
password: ${{ secrets.GH_PERSONAL_TOKEN }}

- name: Install nixpacks
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
curl -sSL https://nixpacks.com/install.sh | bash
- name: Nixpacks version
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
nixpacks --version
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build with nixpacks
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
# TODO remove this once nixpacks supports poetry
export NIXPACKS_PYTHON_VERSION="${{ steps.versions.outputs.python }}"
export NIXPACKS_POETRY_VERSION="${{ steps.versions.outputs.poetry }}"
make docker-push
- name: Sync Repository Metadata
# uses: kbrashears5/github-action-repo-sync@v1.0.0
uses: iloveitaly/github-action-repo-sync@python
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ IMAGE_TAG ?= latest
GITHUB_REPOSITORY ?= $(shell gh repo view --json nameWithOwner --jq '.nameWithOwner' | tr -d '[:space:]')
IMAGE_NAME ?= ghcr.io/$(GITHUB_REPOSITORY)

# NOTE this requires a custom nixpacks build to work:
# TODO once nixpacks is updated to support asdf we can remove hardcoded environment variables below
# https://github.com/railwayapp/nixpacks/pulls?q=is%3Apr+author%3Ailoveitaly

# label is important here in order for the package to show up on the github repo
BUILD_CMD = nixpacks build . --name $(IMAGE_NAME) \
--env NIXPACKS_PYTHON_VERSION \
--env NIXPACKS_POETRY_VERSION \
--label org.opencontainers.image.source=https://github.com/$(GITHUB_REPOSITORY) \
--platform linux/arm64/v8 \
--tag $(IMAGE_TAG)
Expand Down

0 comments on commit 602ba40

Please sign in to comment.