Release / Cria a release (push) Canceled after 0s
Release / CLI (linux-aarch64) (push) Canceled after 0s
Release / CLI (linux-x86_64) (push) Canceled after 0s
Release / CLI (macos-aarch64) (push) Canceled after 0s
Release / CLI (macos-x86_64) (push) Canceled after 0s
Release / CLI (windows-x86_64) (push) Canceled after 0s
Release / App desktop (linux-x86_64) (push) Canceled after 0s
Release / App desktop (macos-aarch64) (push) Canceled after 0s
Release / App desktop (macos-x86_64) (push) Canceled after 0s
Release / App desktop (windows-x86_64) (push) Canceled after 0s
Release / Publica a release (push) Canceled after 0s
147 lines
5.4 KiB
YAML
147 lines
5.4 KiB
YAML
name: Release
|
|
|
|
# Publica uma release pública ao empurrar uma tag vX.Y.Z (ex.: git tag v0.1.0 && git push --tags)
|
|
on:
|
|
push:
|
|
tags: ["v*.*.*"]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
create-release:
|
|
name: Cria a release
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
release_id: ${{ steps.rel.outputs.result }}
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- name: Notas da versão (do CHANGELOG)
|
|
id: notes
|
|
run: |
|
|
v="${GITHUB_REF_NAME#v}"
|
|
v="${v%%-*}"
|
|
awk -v v="$v" '$0 ~ "^## \\[" v "\\]" {f=1; next} /^## \[/ {f=0} f' CHANGELOG.md > notes.md
|
|
[ -s notes.md ] || echo "Veja o CHANGELOG." > notes.md
|
|
- uses: actions/github-script@v9
|
|
id: rel
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const tag = context.ref.replace('refs/tags/', '');
|
|
const r = await github.rest.repos.createRelease({
|
|
owner: context.repo.owner, repo: context.repo.repo, tag_name: tag,
|
|
name: `Guará ${tag}`, body: fs.readFileSync('notes.md', 'utf8'),
|
|
draft: true, prerelease: tag.includes('-'),
|
|
});
|
|
return r.data.id;
|
|
|
|
cli:
|
|
name: CLI (${{ matrix.name }})
|
|
needs: create-release
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { name: linux-x86_64, os: ubuntu-24.04, target: x86_64-unknown-linux-gnu }
|
|
- { name: linux-aarch64, os: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu }
|
|
- { name: macos-aarch64, os: macos-latest, target: aarch64-apple-darwin }
|
|
- { name: macos-x86_64, os: macos-latest, target: x86_64-apple-darwin }
|
|
- { name: windows-x86_64, os: windows-latest, target: x86_64-pc-windows-msvc }
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo build --release --locked -p guara-cli --target ${{ matrix.target }}
|
|
- name: Empacota
|
|
shell: bash
|
|
run: |
|
|
name="guara-${GITHUB_REF_NAME}-${{ matrix.name }}"
|
|
mkdir "$name"
|
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
|
cp target/${{ matrix.target }}/release/guara.exe "$name/"
|
|
else
|
|
cp target/${{ matrix.target }}/release/guara "$name/"
|
|
fi
|
|
cp README.md LICENSE-MIT LICENSE-APACHE "$name/"
|
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
|
7z a "$name.zip" "$name" >/dev/null; asset="$name.zip"
|
|
else
|
|
tar czf "$name.tar.gz" "$name"; asset="$name.tar.gz"
|
|
fi
|
|
if command -v sha256sum >/dev/null; then sha256sum "$asset" > "$asset.sha256"; else shasum -a 256 "$asset" > "$asset.sha256"; fi
|
|
echo "ASSET=$asset" >> "$GITHUB_ENV"
|
|
- name: Envia para a release
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: gh release upload "$GITHUB_REF_NAME" "$ASSET" "$ASSET.sha256" --clobber
|
|
|
|
gui:
|
|
name: App desktop (${{ matrix.name }})
|
|
needs: create-release
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { name: linux-x86_64, os: ubuntu-24.04, args: "" }
|
|
- { name: macos-aarch64, os: macos-latest, args: "--target aarch64-apple-darwin" }
|
|
- { name: macos-x86_64, os: macos-latest, args: "--target x86_64-apple-darwin" }
|
|
- { name: windows-x86_64, os: windows-latest, args: "" }
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ contains(matrix.args, 'apple') && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: apps/gui/src-tauri
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
- name: Dependências do Tauri (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf
|
|
- name: Gera os ícones
|
|
run: npx --yes @tauri-apps/cli@2 icon apps/gui/src-tauri/icons/source.png -o apps/gui/src-tauri/icons
|
|
- uses: tauri-apps/tauri-action@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
projectPath: apps/gui/src-tauri
|
|
releaseId: ${{ needs.create-release.outputs.release_id }}
|
|
args: ${{ matrix.args }}
|
|
|
|
publish:
|
|
name: Publica a release
|
|
needs: [create-release, cli, gui]
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- name: Notas da versão (do CHANGELOG)
|
|
run: |
|
|
v="${GITHUB_REF_NAME#v}"
|
|
v="${v%%-*}"
|
|
awk -v v="$v" '$0 ~ "^## \\[" v "\\]" {f=1; next} /^## \[/ {f=0} f' CHANGELOG.md > notes.md
|
|
[ -s notes.md ] || echo "Veja o CHANGELOG." > notes.md
|
|
- uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
await github.rest.repos.updateRelease({
|
|
owner: context.repo.owner, repo: context.repo.repo,
|
|
release_id: ${{ needs.create-release.outputs.release_id }},
|
|
name: `Guará ${context.ref.replace('refs/tags/', '')}`,
|
|
body: fs.readFileSync('notes.md', 'utf8'),
|
|
draft: false,
|
|
});
|