-
Notifications
You must be signed in to change notification settings - Fork 11
103 lines (90 loc) · 2.79 KB
/
release.yml
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
name: release
on:
push:
branches: [ci_release]
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
# create:
# name: create release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# ref: ${{ github.ref_name }}
# - name: verify version matches
# shell: bash
# run: |
# grep -q 'version = "${{ github.ref_name }}"' Cargo.toml || {echo version mismatch >&2 && exit 1; }
# - name: create release
# run: gh release create ${{ github.ref_name }} --draft --verify-tag --title ${{ github.ref_name }}
build:
name: build
#needs: ['create']
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: i686-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: install rust
shell: bash
run: |
rustup update stable
rustup target add ${{ matrix.target }}
- name: build
shell: bash
run: |
cargo build --verbose --release --target ${{ matrix.target }}
find .
bin="target/${{ matrix.target }}/release/jotdown"
[ "${{ matrix.os }}" = "windows-latest" ] && bin="$bin.exe"
echo "BIN=$bin" >> $GITHUB_ENV
- name: set archive name
shell: bash
run: |
version="${{ needs.create-release.outputs.version }}"
echo "ARCHIVE=jotdown-${{ github.ref_name }}-${{ matrix.target }}" >> $GITHUB_ENV
- name: init archive dir
shell: bash
run: |
mkdir "$ARCHIVE"/
cp "$BIN" "$ARCHIVE"/
cp {COPYING,CHANGELOG.md,README.md} "$ARCHIVE"/
- name: archive (win)
if: ${{ startsWith(matrix.os, 'windows') }}
shell: bash
run: |
7z a "$ARCHIVE.zip" "$ARCHIVE"
echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV
- name: archive (unix)
if: ${{ ! startsWith(matrix.os, 'windows') }}
shell: bash
run: |
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV
# - name: Upload release archive
# shell: bash
# run: |
# version="${{ needs.create-release.outputs.version }}"
# gh release upload "$version" ${{ env.ASSET }}