Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
fpletz committed Mar 31, 2024
1 parent 57f3a3d commit 2c4524f
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 11 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker Action

on:
pull_request:
push:
branches:
- action

env:
CI_PROJECT_PATH: vatger-nav/mapbuilder

jobs:
image:
name: Docker Image
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Log in to the Container registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker images
run: nix build -L .#docker
- name: Push Docker images
run: |
if [ "$GITHUB_EVENT_NAME" != "pull_request" ]; then
skopeo copy --insecure-policy docker-archive://$(readlink -f ./result) docker://ghcr.io/$CI_PROJECT_PATH:$GITHUB_SHA
skopeo copy --insecure-policy docker-archive://$(readlink -f ./result) docker://ghcr.io/$CI_PROJECT_PATH:$GITHUB_REF_NAME
fi
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: 'mapbuilder'
author: 'vatger-nav'
description: 'Builder for GRPlugin and Topsky maps'
runs:
using: 'docker'
image: 'docker://ghcr.io/vatger-nav/mapbuilder:main'
args:
- '--debug'
- '-s'
- '/github/workspace/mapdata'
- '/github/workspace'
branding:
icon: 'map'
color: 'green'
43 changes: 32 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,40 @@
packages.default = poetry2nix.mkPoetryApplication {
inherit overrides;
projectDir = ./.;
checkGroups = [];
};
devShells.default = devEnv.env.overrideAttrs (attrs: {
nativeBuildInputs = attrs.nativeBuildInputs ++ [
pkgs.poetry
pkgs.nil
pkgs.pyright
packages.docker = pkgs.dockerTools.buildLayeredImage {
name = "ghcr.io/vatger-nav/mapbuilder";
tag = "latest";

contents = with pkgs; [
cacert
tzdata
self'.packages.default
];
shellHook = ''
export PYTHONPATH=${devEnv}/${devEnv.sitePackages}
'';
});
formatter = pkgs.nixfmt-rfc-style;
};

config = {
Env = [
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"PYTHONDONTWRITEBYTECODE=1"
"PYTHONUNBUFFERED=1"
];
WorkingDir = "/";
Entrypoint = [ "mapbuilder" ];
};
};
devShells.default = devEnv.env.overrideAttrs (attrs: {
nativeBuildInputs = attrs.nativeBuildInputs ++ [
pkgs.poetry
pkgs.nil
pkgs.pyright
];
shellHook = ''
export PYTHONPATH=${devEnv}/${devEnv.sitePackages}
'';
});
formatter = pkgs.nixfmt-rfc-style;
};
}
);
}

0 comments on commit 2c4524f

Please sign in to comment.