Repository navigation
112 lines (95 loc) · 3.51 KB
/
Copy pathrelease.yml
File metadata and controls
112 lines (95 loc) · 3.51 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions: {}
jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
artifact: code-memory
- os: macos-latest
target: aarch64-apple-darwin
artifact: code-memory
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: code-memory
# Build ARM64 natively. Cross-compiling this target from x64 pulls
# native-tls through fastembed and fails in openssl-sys because the
# runner does not have an ARM64 OpenSSL development toolchain.
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact: code-memory
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: code-memory.exe
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../code-memory-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ matrix.artifact }}
- name: Package (Windows)
if: runner.os == 'Windows'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../code-memory-${{ github.ref_name }}-${{ matrix.target }}.zip ${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: code-memory-${{ matrix.target }}
path: code-memory-${{ github.ref_name }}-${{ matrix.target }}.*
release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download all artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
with:
files: artifacts/**/*
generate_release_notes: true
publish-npm:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false
- name: Update npm package version
run: |
cd npm
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}"
node -e "const p=require('./package.json');p.version='${VERSION}';require('fs').writeFileSync('./package.json',JSON.stringify(p,null,2)+'\n')"
- name: Publish to npm
run: cd npm && npm publish --access public