-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
125 lines (115 loc) · 4.11 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: X-Action
description: X-Action
inputs:
prehook:
description: shell code before execution of entrypoint
required: false
script:
description: script for execution with bash
required: false
code:
description: shell code for execution
required: false
posthook:
description: shell code after execution of entrypoint
required: false
ws_owner_repo:
description: <owner>/<repo>
required: false
ws_repo_ref:
description: repo ref like branch, tag, or other kinds of reference
required: false
github_token:
description: github access token
required: false
ssh_key:
description: ssh key
required: false
git_user:
description: Git Commit Username
required: false
git_email:
description: Git Commit Email
required: false
docker_username:
description: Username for Docker login
required: false
docker_password:
description: Password for Docker login
required: false
docker_buildx_init:
description: buildx init
required: false
artifact_name:
description: artifact_name, default is "artifact"
required: false
artifact_path:
description: artifact_path, default is "~/ws/.artifact"
required: false
artifact_not_found:
description: "Candidates: [warn | error | ignore]"
required: false
artifact_retention_days:
description: "Retention days: 1-90"
required: false
issue_trigger:
description: "[fail | always | never]"
required: false
issue_title:
description: title of issue opening
required: false
issue_assignees:
description: assignees for issue
required: false
issue_template:
description: template
required: false
runs:
using: "composite"
steps:
- name: init x-cmd, git, docker, ssh
shell: bash
env:
github_token: ${{ inputs.github_token || env.github_token }}
ssh_key: ${{ inputs.ssh_key || env.ssh_key }}
ws_owner_repo: ${{ inputs.ws_owner_repo || env.ws_owner_repo || github.repository }}
ws_repo_ref: ${{ inputs.ws_repo_ref || env.ws_repo_ref || github.head_ref || github.ref_name }}
git_user: ${{ inputs.git_user || env.git_user || github.event.head_commit.author.name }}
git_email: ${{ inputs.git_email || env.git_email || github.event.head_commit.author.email }}
docker_username: ${{ inputs.docker_username || env.docker_username }}
docker_password: ${{ inputs.docker_password || env.docker_password }}
docker_buildx_init: ${{ inputs.docker_buildx_init || env.docker_buildx_init }}
___X_CMD_LOG_C_TF: "1"
___X_CMD_GHACTION_INSIDE: "1"
run: |
curl -s https://raw.githubusercontent.com/x-cmd/action/main/lib/index.sh > ~/xghaction
. ~/xghaction init
- name: Running Script
shell: bash
env:
___X_CMD_GHACTION_PREHOOK: ${{ inputs.prehook || env.prehook }}
___X_CMD_GHACTION_SCRIPT: ${{ inputs.script || env.script || format( '.x-cmd/{0}', github.job ) }}
___X_CMD_GHACTION_CODE: '${{ inputs.code }}'
___X_CMD_GHACTION_POSTHOOK: ${{ inputs.posthook || env.posthook }}
___X_CMD_LOG_C_TF: "1"
___X_CMD_GHACTION_INSIDE: "1"
run: . ~/xghaction run
- name: Store Artifact
uses: actions/upload-artifact@v4
id: upload
with:
name: ${{ inputs.artifact_name || env.artifact_name || 'artifact' }}
path: ${{ inputs.artifact_path || '~/ws/.artifact' }}
if-no-files-found: ${{ inputs.artifact_not_found || 'ignore' }}
retention-days: ${{ inputs.artifact_retention_days || env.artifact_retention_days || '10' }}
# Should Upload the artifact using the issue api
# - uses: actions/checkout@v2
# - name: Issue To Preserve
# if: ${{ ( inputs.issue_trigger || env.issue_trigger || 'never' ) != 'never' }}
# uses: JasonEtco/create-an-issue@v2
# with:
# assignees: ${{ inputs.issue_assignees || env.issue_assignees }}
# milestone: ${{ inputs.issue_milestone || env.issue_milestone }}
# filename: ${{ inputs.issue_template || env.issue_template }}
# update_existing: true
# search_existing: "all"