-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (73 loc) · 2.57 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
name: release
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
# branches: ["main"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
name: ${{ matrix.toolchain.name }}
runs-on: ${{ matrix.toolchain.runs_on }}
strategy:
fail-fast: true
matrix:
toolchain:
- {runs_on: ubuntu-latest, name: "Linux x86_64", archive_name: "linux-x86_64"}
- {runs_on: macos-11, name: "macOS x86_64", archive_name: "macos-x86_64"}
- {runs_on: macos-14, name: "macOS AArch64", archive_name: "macos-aarch64"}
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Install Dependencies
if: ${{ matrix.toolchain.archive_name == 'linux-x86_64' }}
run: |
sudo apt-get -y update
sudo apt-get -y install pandoc
- name: Install Dependencies
if: ${{ matrix.toolchain.archive_name != 'linux-x86_64' }}
run: brew install pandoc
- name: format Assets
run: cargo fmt --verbose --all --check
- name: Lint Assets
run: cargo clippy -- -Dwarnings
- name: Build Assets
run: |
cargo build --release
cd docs
pandoc --standalone --to man nvi.1.md -o nvi.1
- name: Run Tests
run: cargo test
- name: Compress Assets
run: |
mkdir -p nvi/bin
mkdir -p nvi/man
cp ./target/release/nvi nvi/bin/
cp ./docs/nvi.1 nvi/man/
tar -zcvf ./nvi-${{ matrix.toolchain.archive_name }}.tar.gz nvi
- name: Upload Assets
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: nvi-${{ matrix.toolchain.archive_name }}
path: nvi-${{ matrix.toolchain.archive_name }}.tar.gz
retention-days: 1
publish:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Set Tag Name
run: TAG_NAME=${{ github.ref }}
- name: Publish Release
run: gh release create $TAG_NAME --generate-notes --title "$TAG_NAME" --target $GITHUB_SHA nvi-macos-x86_64/* nvi-macos-aarch64/* nvi-linux-x86_64/*