-
-
Notifications
You must be signed in to change notification settings - Fork 24
144 lines (130 loc) · 4.64 KB
/
Copy pathpublish-github.yml
File metadata and controls
144 lines (130 loc) · 4.64 KB
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
name: Publish GitHub Release
run-name: "GitHub Release (Run ID: ${{ inputs.run_id || 'latest build' }})"
on:
workflow_dispatch:
inputs:
prerelease:
description: "Mark as pre-release"
required: true
type: boolean
default: false
run_id:
description: "Build workflow run ID (leave empty to use latest)"
required: false
type: string
use_local_storage:
description: "Use local artifact storage"
required: false
type: boolean
default: true
use_self_hosted_runners:
description: "Use self-hosted runners"
required: false
type: boolean
default: true
workflow_call:
inputs:
prerelease:
description: "Mark as pre-release"
required: true
type: boolean
default: false
run_id:
description: "Build workflow run ID (leave empty to use latest)"
required: false
type: string
use_local_storage:
description: "Use local artifact storage"
required: false
type: boolean
default: true
use_self_hosted_runners:
description: "Use self-hosted runners"
required: false
type: boolean
default: true
permissions:
contents: write
jobs:
release:
name: Create GitHub Release
runs-on: ${{ inputs.use_self_hosted_runners && fromJson('["self-hosted","Linux"]') || fromJson('["ubuntu-latest"]') }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Validate local storage configuration
uses: ./.github/actions/validate-local-storage
with:
use_local_storage: ${{ inputs.use_local_storage }}
artifact_host: ${{ vars.ARTIFACT_HOST }}
artifact_base_path: ${{ vars.ARTIFACT_BASE_PATH }}
- name: Get Latest Build Run ID
id: get-run-id
uses: ./.github/actions/get-latest-build-run-id
with:
run_id: ${{ inputs.run_id }}
github_token: ${{ github.token }}
- name: Download Server Artifact
uses: ./.github/actions/download-artifact
with:
name: Server
path: ./server-publish
github-token: ${{ github.token }}
artifact-host: ${{ inputs.use_local_storage && vars.ARTIFACT_HOST || '' }}
artifact-base-path: ${{ inputs.use_local_storage && vars.ARTIFACT_BASE_PATH || '' }}
run-id: ${{ steps.get-run-id.outputs.run_id }}
- name: Download docker-compose file
uses: ./.github/actions/download-artifact
with:
name: DockerCompose
path: ./docker-compose-download
github-token: ${{ github.token }}
artifact-host: ${{ inputs.use_local_storage && vars.ARTIFACT_HOST || '' }}
artifact-base-path: ${{ inputs.use_local_storage && vars.ARTIFACT_BASE_PATH || '' }}
run-id: ${{ steps.get-run-id.outputs.run_id }}
- name: Get Version from Version.txt
id: get-version
shell: bash
run: |
VERSION=$(cat ./server-publish/wwwroot/downloads/Version.txt)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Copy OpenAPI Spec
shell: bash
run: |
cp ./server-publish/ControlR.Web.Server.json ./ControlR.Web.Server.json
- name: Prepare Release Artifacts
shell: bash
run: |
# Create server zip
cd server-publish
zip -r ../server-linux-amd64.zip .
cd ..
cp docker-compose-download/docker-compose.yml .
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
name: v${{ steps.get-version.outputs.VERSION }} Release
tag_name: v${{ steps.get-version.outputs.VERSION }}
draft: true
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
body: |
## Breaking Changes:
-
## Changes:
-
files: |
server-linux-amd64.zip
ControlR.Web.Server.json
docker-compose.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Created
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "**Version:** v${{ steps.get-version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "**Status:** Draft" >> $GITHUB_STEP_SUMMARY
echo "**Pre-release:** ${{ inputs.prerelease }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ Release is in DRAFT mode - review and publish when ready" >> $GITHUB_STEP_SUMMARY