-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (114 loc) · 3.35 KB
/
main.yaml
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
name: main
on:
push:
branches:
- main
tags:
- "*"
pull_request:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
set-safe-directory: true
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: pre-commit/[email protected]
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
suffix: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ''
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Archive release artifacts
uses: actions/upload-artifact@v4
with:
name: mod_installer-${{ matrix.target }}${{ matrix.suffix }}
path: ./target/release/mod_installer${{ matrix.suffix }}
release:
needs: [build, pre-commit]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
tag_name: ${{ steps.get_tag.outputs.git_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/[email protected]
id: git-cliff
with:
config: cliff.toml
args: --latest --verbose
env:
OUTPUT: CHANGELOG.md
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
- name: Get the tag
id: get_tag
run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: ncipollo/[email protected]
with:
bodyFile: ./CHANGELOG.md
prerelease: ${{ startsWith(steps.get_tag.outputs.git_tag, 'nightly') }}
upload:
needs: [release]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
suffix: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ''
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: mod_installer-${{ matrix.target }}${{ matrix.suffix }}
- name: Upload Release Asset - ${{ matrix.os }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./mod_installer${{ matrix.suffix }}
asset_name: mod_installer-${{ matrix.target }}${{ matrix.suffix }}
asset_content_type: application/octet-stream