#!/usr/bin/env nu const CODEBERG_USER = "wvhulle" const RELEASE_BRANCH_NAME = "main" export def authenticated-origin-url [repository_slug: string, access_token: string]: nothing -> string { $"https://($CODEBERG_USER):($access_token)@codeberg.org/($repository_slug).git" } def run-release-plz [release_subcommand: string]: nothing -> nothing { ^release-plz $release_subcommand --forge gitea --git-token $env.CODEBERG_TOKEN } def "main release-plz-release" []: nothing -> nothing { ^git remote set-url origin (authenticated-origin-url $env.CI_REPO $env.CODEBERG_TOKEN) ^git checkout -B $RELEASE_BRANCH_NAME $env.CI_COMMIT_SHA run-release-plz release } def "main release-plz-release-pr" []: nothing -> nothing { run-release-plz release-pr } def "main check-conventional-commits" [ --fetch-target-branch ...revision_ranges: string ]: nothing -> nothing { if $fetch_target_branch { ^git fetch --quiet origin $env.CI_COMMIT_TARGET_BRANCH } ^convco check ...$revision_ranges } def main []: nothing -> nothing { print "Run a subcommand, for example: check-conventional-commits" }