Skip to content

Commit

Permalink
Merge pull request #2 from sarcasticadmin/rh/1672626335
Browse files Browse the repository at this point in the history
[READY] - Release process with pdfs
  • Loading branch information
sarcasticadmin authored Jan 2, 2023
2 parents a5bd9fc + f27b502 commit 8a72377
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: release

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
releaser:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: install-nix
uses: cachix/install-nix-action@v18
- name: create-release-with-artifacts
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
RELEASE_TAG: ${{github.ref_name}}
run:
nix develop .#release --command ci-release
18 changes: 17 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
};
simple-slides = final.callPackage ./simple/default.nix { };
openwrt-at-scale = final.callPackage ./openwrt-at-scale/default.nix { };
all-slides = final.linkFarmFromDrvs "all-slides" [ simple-slides openwrt-at-scale ];

};

packages = forAllSystems (system: {
inherit (nixpkgsFor.${system}) simple-slides openwrt-at-scale;
inherit (nixpkgsFor.${system}) simple-slides openwrt-at-scale all-slides;
});

devShells = forAllSystems (system:
Expand All @@ -48,6 +50,20 @@
rubber
];
};
release =
let
ciRelease = pkgs.writeScriptBin "ci-release" ''
test ! -z $RELEASE_TAG || { echo "Please set RELEASE_TAG variable"; exit 1; }
nix build '.#all-slides'
gh release create $RELEASE_TAG result/**/*.pdf -t "$RELEASE_TAG" --notes ""
'';
in
pkgs.mkShell {
buildInputs = with pkgs;[
gh
] ++ [ ciRelease ];
};

});
};
# Bold green prompt for `nix develop`
Expand Down
2 changes: 1 addition & 1 deletion openwrt-at-scale/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ stdenv.mkDerivation {

installPhase = ''
mkdir -p $out
cp slides.pdf $out/
cp slides.pdf $out/$pname-slides.pdf
'';
}
4 changes: 2 additions & 2 deletions simple/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ texLive, rubber, stdenv, lib }:

stdenv.mkDerivation {
pname = "simple-slides";
pname = "simple";
version = "1970-01-01";

src = ./.;
Expand All @@ -13,6 +13,6 @@ stdenv.mkDerivation {

installPhase = ''
mkdir -p $out
cp slides.pdf $out/
cp slides.pdf $out/$pname-slides.pdf
'';
}

0 comments on commit 8a72377

Please sign in to comment.