Skip to content

Commit

Permalink
Auto-release using a date-based tag on master push
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Jul 7, 2023
1 parent 32de0f7 commit 52850e7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "release"

on:
push:
branches:
- "master"

jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v3

- name: "Generate tag"
id: tag
run: echo tag=$(./tools/auto_version.py) >> "$GITHUB_OUTPUT"

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ steps.tag.outputs.tag }}"
5 changes: 2 additions & 3 deletions cli.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, version
}:
let
inherit (pkgs) python3;
in
pkgs.stdenv.mkDerivation {
pname = "poetry2nix";
inherit version;
pname = "poetry2nix-cli";
version = "0";

buildInputs = [
(python3.withPackages (ps: [ ps.toml ]))
Expand Down
6 changes: 0 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
, poetryLib ? import ./lib.nix { inherit lib pkgs; stdenv = pkgs.stdenv; }
}:
let
# Poetry2nix version
version = "1.42.1";

inherit (poetryLib) isCompatible readTOML normalizePackageName normalizePackageSet;

# Map SPDX identifiers to license names
Expand Down Expand Up @@ -93,9 +90,6 @@ let

in
lib.makeScope pkgs.newScope (self: {

inherit version;

/* Returns a package of editable sources whose changes will be available without needing to restart the
nix-shell.
In editablePackageSources you can pass a mapping from package name to source directory to have
Expand Down
10 changes: 10 additions & 0 deletions tools/auto_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3
from datetime import datetime

# Outputs a version number to be tagged by github actions
if __name__ == "__main__":
now = datetime.utcnow()
modifier = int(
(now - now.replace(hour=0, minute=0, second=0, microsecond=0)).total_seconds()
)
print(now.strftime(f"%Y.%m.%d.{modifier}"))

0 comments on commit 52850e7

Please sign in to comment.