-
Notifications
You must be signed in to change notification settings - Fork 3
125 lines (103 loc) · 3.49 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (103 loc) · 3.49 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
name: Build and Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: doom-mcp-linux-x64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary: doom-mcp-linux-arm64
cross: true
- os: macos-latest
target: x86_64-apple-darwin
binary: doom-mcp-darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
binary: doom-mcp-darwin-arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: doom-mcp-win32-x64.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Clone doomgeneric
run: |
git clone https://github.com/ozkl/doomgeneric.git engine/doomgeneric
cd engine/doomgeneric
git checkout fc601639494e089702a1ada082eb51aaafc03722
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
- name: Run tests
if: ${{ !matrix.cross }}
run: cargo test
- name: Create engine directory
run: mkdir -p npm/engine
- name: Copy binary (unix)
if: matrix.os != 'windows-latest'
run: cp target/${{ matrix.target }}/release/doom-mcp npm/engine/${{ matrix.binary }}
- name: Copy binary (windows)
if: matrix.os == 'windows-latest'
run: cp target/${{ matrix.target }}/release/doom-mcp.exe npm/engine/${{ matrix.binary }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: npm/engine/${{ matrix.binary }}
package:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all binaries
uses: actions/download-artifact@v4
with:
path: npm/engine/
merge-multiple: true
- name: Download Freedoom WAD
run: |
mkdir -p npm/wad
curl -fSL "https://github.com/freedoom/freedoom/releases/download/v0.13.0/freedoom-0.13.0.zip" -o /tmp/freedoom.zip
unzip -q /tmp/freedoom.zip -d /tmp/freedoom
cp /tmp/freedoom/freedoom-0.13.0/freedoom1.wad npm/wad/
- name: Set binary permissions
run: chmod +x npm/engine/doom-mcp-*
- name: Copy docs to npm package
run: |
cp README.md npm/
cp LICENSE npm/
cp CHANGELOG.md npm/
- name: Show package contents
run: ls -lh npm/engine/ npm/wad/
- name: Upload npm package
uses: actions/upload-artifact@v4
with:
name: npm-package
path: npm/
- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/v')
run: |
cd npm
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}