Merge branch 'develop' #42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |