Skip to content

Commit 05bf53f

Browse files
Refactor workflows for building and releasing server and plugin
1 parent c1eea90 commit 05bf53f

File tree

6 files changed

+83
-112
lines changed

6 files changed

+83
-112
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build Server and Plugin
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'plugin/**'
8+
- 'server/**'
9+
- '.github/workflows/**'
10+
- '.github/actions/**'
11+
pull_request:
12+
paths:
13+
- 'plugin/**'
14+
- 'server/**'
15+
- '.github/workflows/**'
16+
- '.github/actions/**'
17+
workflow_dispatch:
18+
19+
jobs:
20+
build-server:
21+
name: Build server
22+
uses: ./.github/workflows/server.yml
23+
secrets: inherit
24+
25+
build-plugin:
26+
name: Build plugin
27+
needs: build-server
28+
uses: ./.github/workflows/plugin.yml
29+
secrets: inherit

.github/workflows/plugin.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
name: Plugin
22

33
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- 'plugin/**'
8-
- 'server/**'
9-
- '.github/workflows/plugin.yml'
10-
pull_request:
11-
paths:
12-
- 'plugin/**'
13-
- 'server/**'
14-
- '.github/workflows/plugin.yml'
154
workflow_dispatch:
165
workflow_call:
176
inputs:
@@ -112,6 +101,18 @@ jobs:
112101
echo "PRODUCTION=true" >> $GITHUB_ENV
113102
fi
114103
104+
- name: Download server artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: deweb-server_${{ matrix.target }}_${{ matrix.arch }}
108+
path: server/build
109+
110+
- name: Rename server binary
111+
shell: bash
112+
run: |
113+
mkdir -p build
114+
mv server/build/deweb-server_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }} build/deweb-server${{ matrix.ext }}
115+
115116
- name: Build Plugin
116117
shell: bash
117118
run: task build
@@ -122,16 +123,25 @@ jobs:
122123
- name: Rename Plugin artifact
123124
run: mv build/deweb-plugin${{ matrix.ext }} deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }}
124125

125-
- name: Copy shared files to platform directory
126+
- name: Create platform directory with all required files
126127
shell: bash
127128
run: |
128129
mkdir -p platform_${{ matrix.target }}_${{ matrix.arch }}
129130
cp deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }} platform_${{ matrix.target }}_${{ matrix.arch }}/
131+
cp build/deweb-server${{ matrix.ext }} platform_${{ matrix.target }}_${{ matrix.arch }}/
130132
cp favicon.png platform_${{ matrix.target }}_${{ matrix.arch }}/
131133
cp manifest.json platform_${{ matrix.target }}_${{ matrix.arch }}/
132134
133-
- name: Upload Plugin artifact
135+
- name: Create zip package
136+
shell: bash
137+
run: |
138+
cd platform_${{ matrix.target }}_${{ matrix.arch }}
139+
zip -r ../deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}.zip *
140+
cd ..
141+
ls -la deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}.zip
142+
143+
- name: Upload Plugin zip package
134144
uses: actions/upload-artifact@v4
135145
with:
136-
name: deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}
137-
path: plugin/platform_${{ matrix.target }}_${{ matrix.arch }}/
146+
name: deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}_zip
147+
path: plugin/deweb-plugin_${{ matrix.target }}_${{ matrix.arch }}.zip
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Plugin Release
1+
name: Release DeWeb
22

33
on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Plugin version for this release (without v prefix)'
7+
description: 'Version for this release (without v prefix)'
88
required: true
99
type: string
1010
release-as-draft:
@@ -42,52 +42,52 @@ jobs:
4242
fi
4343
echo "Manifest version matches input version: $version"
4444
45+
build-server:
46+
needs: check-manifest
47+
uses: ./.github/workflows/server.yml
48+
with:
49+
version: ${{ inputs.version }}
50+
secrets: inherit
51+
4552
build-plugin:
53+
needs: build-server
4654
uses: ./.github/workflows/plugin.yml
47-
needs: check-manifest
4855
with:
4956
version: ${{ inputs.version }}
5057
secrets: inherit
5158

5259
create-release:
53-
needs: [check-manifest, build-plugin]
60+
needs: [build-server, build-plugin]
5461
runs-on: ubuntu-latest
5562
permissions:
5663
contents: write
5764
steps:
58-
- name: Download all artifacts
65+
- name: Download server artifacts
5966
uses: actions/download-artifact@v4
6067
with:
61-
path: artifacts
62-
pattern: 'deweb-plugin_*'
68+
path: artifacts/server
69+
pattern: 'deweb-server_*'
6370

64-
- name: List artifacts
65-
run: ls -R artifacts
66-
67-
- name: Create zip packages for each platform
68-
run: |
69-
mkdir -p release_zips
70-
71-
# Find all artifact folders
72-
for platform_dir in artifacts/deweb-plugin_*; do
73-
# Extract the platform name from the directory
74-
platform_name=$(basename "$platform_dir")
75-
76-
# Create a zip package for this platform
77-
(cd "$platform_dir" && zip -r "../../release_zips/${platform_name}.zip" *)
78-
79-
echo "Created zip package for $platform_name"
80-
done
81-
82-
ls -la release_zips/
71+
- name: Download plugin zip packages
72+
uses: actions/download-artifact@v4
73+
with:
74+
path: artifacts/plugin
75+
pattern: 'deweb-plugin_*_zip'
76+
77+
- name: ls -la artifacts/server
78+
run: ls -la artifacts/server
79+
80+
- name: ls -la artifacts/plugin
81+
run: ls -la artifacts/plugin
8382

8483
- name: Create Release
8584
uses: softprops/action-gh-release@v2
8685
with:
87-
tag_name: plugin-v${{ inputs.version }}
88-
name: plugin v${{ inputs.version }}
86+
tag_name: v${{ inputs.version }}
87+
name: DeWeb v${{ inputs.version }}
8988
draft: ${{ inputs.release-as-draft }}
9089
prerelease: ${{ inputs.release-as-prerelease }}
9190
generate_release_notes: ${{ inputs.generate-release-notes }}
9291
files: |
93-
release_zips/*.zip
92+
artifacts/deweb-server_*/deweb-server_*
93+
artifacts/plugin/deweb-plugin_*_zip/deweb-plugin_*.zip

.github/workflows/server-release.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/server.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
name: Server
22

33
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- 'server/**'
8-
- '.github/workflows/server.yml'
9-
pull_request:
10-
paths:
11-
- 'server/**'
12-
- '.github/workflows/server.yml'
134
workflow_dispatch:
145
workflow_call:
156
inputs:

plugin/Taskfile.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ tasks:
99
cmds:
1010
- cmd: mkdir -p ./build
1111
- cmd: go generate ./...
12-
- task: build-server
1312

1413
build-server:
15-
internal: true
1614
dir: ../server
1715
cmds:
1816
- cmd: task build

0 commit comments

Comments
 (0)