-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (98 loc) · 2.94 KB
/
Copy pathrelease.yml
File metadata and controls
113 lines (98 loc) · 2.94 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
name: Release
permissions:
contents: write
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release"
required: true
jobs:
dist:
name: Build and package
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- target: x86_64-apple-darwin
runner: macos-latest
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-pc-windows-msvc
runner: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install npm dependencies
run: npm ci
working-directory: web/mapit-web
- name: Build frontend
run: npm run build
working-directory: web/mapit-web
- name: Stage frontend dist for embed
shell: bash
run: |
mkdir -p crates/mapit-server/embedded_dist
cp -r web/mapit-web/dist/* crates/mapit-server/embedded_dist/
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --package mapit-cli
- name: Package binary
shell: bash
run: |
BINARY_NAME="mapit"
if [[ "${{ matrix.target }}" == *-windows-* ]]; then BINARY_NAME="mapit.exe"; fi
mkdir -p dist
cp "target/${{ matrix.target }}/release/$BINARY_NAME" "dist/$BINARY_NAME"
- name: Create archive
shell: bash
run: |
ARCHIVE_NAME="mapit-${{ matrix.target }}"
if [[ "${{ matrix.target }}" == *-windows-* ]]; then
7z a "${ARCHIVE_NAME}.zip" dist/mapit.exe
else
tar czf "${ARCHIVE_NAME}.tar.gz" -C dist mapit
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mapit-${{ matrix.target }}
path: |
dist/
*.tar.gz
*.zip
release:
name: Create release
needs: dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate checksums
run: |
cd artifacts
find . -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec sh -c 'sha256sum "$1" >> ../checksums.txt' _ {} \;
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body_path: CHANGELOG.md
files: |
artifacts/**/*.tar.gz
artifacts/**/*.zip
checksums.txt
fail_on_unmatched_files: true
generate_release_notes: true