docs: deploy using dagger
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
@@ -40,6 +40,11 @@ package op
|
||||
dir: string
|
||||
}
|
||||
|
||||
#Workdir: {
|
||||
do: "workdir"
|
||||
path: string
|
||||
}
|
||||
|
||||
#Exec: {
|
||||
do: "exec"
|
||||
args: [...string]
|
||||
|
@@ -12,6 +12,7 @@ package op
|
||||
#Copy |
|
||||
#Load |
|
||||
#Subdir |
|
||||
#Workdir |
|
||||
#WriteFile |
|
||||
#Mkdir |
|
||||
#DockerBuild) & {do: string}
|
||||
|
@@ -1,7 +1,9 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/op"
|
||||
"dagger.io/alpine"
|
||||
)
|
||||
|
||||
// A git repository
|
||||
@@ -23,3 +25,82 @@ import (
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Get the name of the current checked out branch or tag
|
||||
#CurrentBranch: {
|
||||
repository: dagger.#Artifact @dagger(input)
|
||||
name: {
|
||||
string
|
||||
@dagger(output)
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
package: git: "=~2.30"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
mount: "/repository": from: repository
|
||||
dir: "/repository"
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
printf "$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)" > /name.txt
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/name.txt"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// List tags of a repository
|
||||
#Tags: {
|
||||
repository: dagger.#Artifact @dagger(input)
|
||||
tags: {
|
||||
[...string]
|
||||
@dagger(output)
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
package: bash: "=~5.1"
|
||||
package: jq: "=~1.6"
|
||||
package: git: "=~2.30"
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
mount: "/repository": from: repository
|
||||
dir: "/repository"
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
git tag -l | jq --raw-input --slurp 'split("\n") | map(select(. != ""))' > /tags.json
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/tags.json"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user