name: Release on: push: tags: - "v*" permissions: contents: read jobs: release: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 - name: Tag igual à versão do projeto run: bash scripts/tests/test-versions.sh "$GITHUB_REF_NAME" - name: Notas da versão e arquivos da release run: | version="${GITHUB_REF_NAME#v}" awk -v version="$version" ' index($0, "## [" version "]") == 1 { on = 1; next } on && /^## \[/ { exit } on { print } ' CHANGELOG.md > notes.md [[ -s notes.md ]] || { echo "CHANGELOG.md sem notas para a versão ${version}."; exit 1; } mkdir dist cp scripts/install.sh scripts/install.ps1 dist/ (cd dist && sha256sum install.sh install.ps1 > SHA256SUMS) cat dist/SHA256SUMS # Se a release já foi criada à mão, só os arquivos são enviados; as notas ficam como estão. - name: Publicar instaladores e SHA256SUMS na release env: GH_TOKEN: ${{ github.token }} run: | if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then gh release upload "$GITHUB_REF_NAME" dist/install.sh dist/install.ps1 dist/SHA256SUMS --clobber else gh release create "$GITHUB_REF_NAME" dist/install.sh dist/install.ps1 dist/SHA256SUMS \ --title "$GITHUB_REF_NAME" --notes-file notes.md fi