diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b59ada3..6c9db6f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,12 @@ on: push: branches: - main + tags: + - 'BETA-*' + - 'PRE-BETA-*' + - 'Alpha*' + - 'RELEASE-*' + - 'v*' pull_request: jobs: @@ -198,3 +204,51 @@ jobs: cache: true - run: flutter pub get - run: flutter build web --release --no-pub + + publish-linux-assets: + if: startsWith(github.ref, 'refs/tags/') + needs: + - linux + - linux-arm64 + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: linux-x86_64-appimage + path: release/linux-x86_64 + - uses: actions/download-artifact@v4 + with: + name: linux-arm64-appimage + path: release/linux-arm64 + - name: Prepare Linux AppImages + run: | + set -euo pipefail + version="$(sed -n 's/^version: *//p' pubspec.yaml)" + test -n "$version" + x86_64="$(find release/linux-x86_64 -type f -name 'meshcore-open-x86_64.AppImage' -print -quit)" + aarch64="$(find release/linux-arm64 -type f -name 'meshcore-open-aarch64.AppImage' -print -quit)" + test -n "$x86_64" + test -n "$aarch64" + mkdir -p dist + cp "$x86_64" "dist/meshcore-open-${version}-linux-x86_64.AppImage" + cp "$aarch64" "dist/meshcore-open-${version}-linux-aarch64.AppImage" + chmod +x dist/*.AppImage + - name: Publish Linux AppImages + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + TAG: ${{ github.ref_name }} + run: | + set -euo pipefail + files=(dist/*.AppImage) + if gh release view "$TAG" >/dev/null 2>&1; then + gh release upload "$TAG" "${files[@]}" --clobber + else + gh release create "$TAG" "${files[@]}" \ + --verify-tag \ + --title "$TAG" \ + --generate-notes + fi diff --git a/README.md b/README.md index 3a768b7f..958589d7 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,17 @@ flutter build apk --release flutter build ios --release ``` +**GitHub Releases:** + +Pushing a release tag (`BETA-*`, `PRE-BETA-*`, `Alpha*`, `RELEASE-*`, or +`v*`) runs CI and attaches both Linux AppImages to that tag's GitHub Release: + +- `meshcore-open--linux-x86_64.AppImage` +- `meshcore-open--linux-aarch64.AppImage` + +If the tag has no release yet, CI creates one with generated notes. Re-running +the workflow replaces the existing Linux assets. + ## Project Structure ```