mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-16 17:54:07 +01:00
Support github deploy task (#3512)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
"deploy_pipeline": {
|
||||
"title": "Trigger deployment event for current pipeline #{pipelineId}",
|
||||
"enter_target": "Target deployment environment",
|
||||
"enter_task": "Deployment task",
|
||||
"trigger": "Deploy",
|
||||
"variables": {
|
||||
"delete": "Delete variable",
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<InputField v-slot="{ id }" :label="$t('repo.deploy_pipeline.enter_target')">
|
||||
<TextField :id="id" v-model="payload.environment" required />
|
||||
</InputField>
|
||||
<InputField v-slot="{ id }" :label="$t('repo.deploy_pipeline.enter_task')">
|
||||
<TextField :id="id" v-model="payload.task" />
|
||||
</InputField>
|
||||
<InputField v-slot="{ id }" :label="$t('repo.deploy_pipeline.variables.title')">
|
||||
<span class="text-sm text-wp-text-alt-100 mb-2">{{ $t('repo.deploy_pipeline.variables.desc') }}</span>
|
||||
<div class="flex flex-col gap-2">
|
||||
@@ -69,9 +72,10 @@ const repo = inject('repo');
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const payload = ref<{ id: string; environment: string; variables: { name: string; value: string }[] }>({
|
||||
const payload = ref<{ id: string; environment: string; task: string; variables: { name: string; value: string }[] }>({
|
||||
id: '',
|
||||
environment: '',
|
||||
task: '',
|
||||
variables: [
|
||||
{
|
||||
name: '',
|
||||
|
||||
@@ -31,6 +31,7 @@ type PipelineOptions = {
|
||||
type DeploymentOptions = {
|
||||
id: string;
|
||||
environment: string;
|
||||
task: string;
|
||||
variables: Record<string, string>;
|
||||
};
|
||||
|
||||
@@ -89,12 +90,13 @@ export default class WoodpeckerClient extends ApiClient {
|
||||
}
|
||||
|
||||
// Deploy triggers a deployment for an existing pipeline using the
|
||||
// specified target environment.
|
||||
// specified target environment and task.
|
||||
deployPipeline(repoId: number, pipelineNumber: string, options: DeploymentOptions): Promise<Pipeline> {
|
||||
const vars = {
|
||||
...options.variables,
|
||||
event: 'deployment',
|
||||
deploy_to: options.environment,
|
||||
deploy_task: options.task,
|
||||
};
|
||||
const query = encodeQueryString(vars);
|
||||
return this._post(`/api/repos/${repoId}/pipelines/${pipelineNumber}?${query}`) as Promise<Pipeline>;
|
||||
|
||||
Reference in New Issue
Block a user