-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (80 loc) · 2.48 KB
/
build-deb-develop.yml
File metadata and controls
93 lines (80 loc) · 2.48 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
name: Build and Release .deb
on:
push:
branches:
- develop
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-*"
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build release
run: cargo build --release
- name: Build .deb
run: cargo deb
- name: Upload .deb artifact (sempre)
uses: actions/upload-artifact@v4
with:
name: deb-package
path: target/debian/*.deb
#Detecta tipo quando for TAG
- name: Detect prerelease or stable (from tag)
if: startsWith(github.ref, 'refs/tags/')
id: relmeta
run: |
TAG="${GITHUB_REF_NAME}"
if [[ "$TAG" =~ -(alpha|beta|rc) ]]; then
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
echo "RELEASE_NAME=Beta - ${TAG}" >> $GITHUB_OUTPUT
else
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
echo "RELEASE_NAME=Stable - ${TAG}" >> $GITHUB_OUTPUT
fi
- name: Generate SHA256 checksums
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
run: |
cd target/debian
for f in *.deb; do
sha256sum "$f" > "$f.sha256"
done
#Release para TAGS semânticas
- name: Create GitHub Release (tags only)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ steps.relmeta.outputs.RELEASE_NAME }}
draft: false
prerelease: ${{ steps.relmeta.outputs.PRERELEASE }}
files: |
target/debian/*.deb
target/debian/*.sha256
#release para PUSH na main (sem tag)
- name: Create/Update Main Release (branch push)
if: github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v2
with:
tag_name: Ubuntu-linux
name: Ubuntu linux-Stable
draft: false
prerelease: false
make_latest: true
files: |
target/debian/*.deb
target/debian/*.sha256