-
Notifications
You must be signed in to change notification settings - Fork 113
183 lines (179 loc) · 6.2 KB
/
publish-base.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Reusable binary publish workflow
permissions:
contents: write
on:
workflow_call:
inputs:
<<<<<<< HEAD
=======
# The tag that we are publishing to
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
tag:
required: false
type: string
default: ""
<<<<<<< HEAD
description: The version tag to publish
github-artifact-name:
required: true
type: string
description: The github artifact to download the artifact from.
# The path after the target-path to publish the artifact to
# {artifact | {target-path}/{target-artifact-path}
target-artifact-path:
required: false
type: string
default: ""
description: |
The path that goes after target-path to specify a subdirectory
to publish to. Final path: {target-path}/{target-artifact-path}
# The path within the github artifact that the artifact is located at.
source-path:
required: false
type: string
default: ""
description: |
The path within the github artifact where the artifact is located at
secrets:
# The target path within the host share to save files to
target-path:
required: true
description: |
The path within the host machine where the data should be published
to.
ssh-key:
required: true
description: The ssh private key that is used to publish to the host.
host:
required: true
description: The host that has sshd running to publish to.
port:
required: true
description: The port the host is running sshd on.
user:
required: true
description: THe username to log in to the server as.
jobs:
publish:
runs-on: ubuntu-latest
steps:
# If this is somehow not run from a tag, fail. This is a remainder from
# when the build side and publish side were done in one workflow.
- name: Check tag status
if: |
startsWith(github.ref, 'refs/tags/')
&& ! endsWith(github.ref, inputs.tag)
=======
# The name of what we are building
artifact:
required: true
type: string
# The name that will be used to same build artifacts to share
# between jobs
github-artifact-name:
required: true
type: string
# The root path to publish package to. If left blank, artifact
# is used.
artifact-target-name:
required: false
type: string
default: ""
# The target path that goes before the artifact-target-name
# {artifact | artifact-target-name}/{target-path}
target-path:
required: false
type: string
default: ""
# The folder where the stuff to be published is located
source:
required: true
type: string
secrets:
ssh-key:
required: true
host:
required: true
port:
required: true
user:
required: true
jobs:
publish:
runs-on: macos-latest
steps:
- name: Check tag status
if: ${{ startsWith(github.ref, 'refs/tags/') && ! endsWith(github.ref, input.tag) }}
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
uses: actions/github-script@v3
with:
script: |
core.setFailed("Provided tag does not match github ref tag")
<<<<<<< HEAD
# Download the requested github artifact
- name: Download artifacts
id: download
uses: actions/download-artifact@v4
with:
name: ${{ inputs.github-artifact-name }}
# Get the path to where the artifact is at. This is the path to the
# downloaded artifact that is relative to the github workspace with the
# source-path parameter tacked on the end.
- name: Get Source Path
shell: bash
id: get-source-path
run: |
echo "path=$( \
realpath -s --relative-to="${{ github.workspace }}" \
"${{ steps.download.outputs.download-path }}/${{ inputs.source-path }}" \
)" >> $GITHUB_OUTPUT
# Publish to the host
=======
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ input.github-artifact-name }}
- name: Get Target
id: get-target
run: |
if [ -z ${{ input.artifact-target-name }} ]; then
echo "PUB_TARGET=${{ input.artifact }}" >> $GITHUB_OUTPUT;
else
echo "PUB_TARGET=${{ input.artifact-target-name }}" >> $GITHUB_OUTPUT;
fi
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
- name: Publish Release
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.ssh-key }}
ARGS: "-vzrli"
<<<<<<< HEAD
SOURCE: ${{ steps.get-source-path.outputs.path }}
REMOTE_HOST: ${{ secrets.host }}
REMOTE_USER: ${{ secrets.user }}
REMOTE_PORT: ${{ secrets.port }}
TARGET: ${{ secrets.target-path }}/${{ inputs.target-artifact-path }}
# Create the release draft on GitHub.
- name: Create Release Draft
if: ${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, inputs.tag) }}
uses: ncipollo/release-action@v1
with:
# artifacts: "artifacts-${{ github.sha }}/*"
# artifactErrorsFailBuild: true
=======
SOURCE: ${{ input.source }}
REMOTE_HOST: ${{ secrets.host }}
REMOTE_USER: ${{ secrets.user }}
REMOTE_PORT: ${{ secrets.port }}
TARGET: ${{ steps.get-target.outputs.PUB_TARGET }}/${{ inputs.target-path }}
- name: Create Release Draft
if: ${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, input.tag) }}
uses: ncipollo/release-action@v1
with:
artifacts: ${{ input.source }}/*
artifactErrorsFailBuild: true
>>>>>>> ea386ec (ci: implement build pipeline and patch to zig master)
draft: true
generateReleaseNotes: true
tag: ${{ inputs.tag }}
prerelease: ${{ contains(inputs.tag, '-beta') || contains(inputs.tag, '-alpha') || contains(inputs.tag, '-rc') }}