diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index 838242d1a..9774053d3 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -37,6 +37,33 @@ jobs: - name: Check out code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Rust toolchain (for cargo metadata) + uses: dtolnay/rust-toolchain@stable + + - name: Sync metainfo version from Cargo.toml + run: | + VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "dash-evo-tool") | .version') + if [ -z "$VERSION" ]; then + echo "::error::Failed to extract version from Cargo.toml" + exit 1 + fi + # Use release published date when available, tag commit date for tag pushes, current date otherwise + if [ -n "${{ github.event.release.published_at }}" ]; then + DATE=$(echo "${{ github.event.release.published_at }}" | cut -dT -f1) + elif [ "${{ github.ref_type }}" = "tag" ]; then + DATE=$(git log -1 --format=%cs "${{ github.ref }}") + else + DATE=$(date +%Y-%m-%d) + fi + sed -i "s|> "$GITHUB_OUTPUT" + echo "plist_version=$PLIST_VERSION" >> "$GITHUB_OUTPUT" + echo "build_number=${{ github.run_number }}" >> "$GITHUB_OUTPUT" + echo "Extracted version: $VERSION (plist: $PLIST_VERSION, build: ${{ github.run_number }})" + - name: Initial disk cleanup run: | echo "Disk usage before initial cleanup:" @@ -270,9 +289,9 @@ jobs: CFBundleDisplayName Dash Evo Tool CFBundleVersion - 1.0.0 + ${{ steps.version.outputs.build_number }} CFBundleShortVersionString - 1.0.0 + ${{ steps.version.outputs.plist_version }} CFBundlePackageType APPL CFBundleSignature @@ -474,6 +493,25 @@ jobs: - name: Add Rust target run: rustup target add x86_64-apple-darwin + - name: Extract version from Cargo.toml + id: version + run: | + VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "dash-evo-tool") | .version') + if [ -z "$VERSION" ]; then + echo "::error::Failed to extract version from Cargo.toml" + exit 1 + fi + # Strip prerelease and build metadata suffixes for macOS plist (Apple requires numeric-only) + PLIST_VERSION=$(echo "$VERSION" | sed 's/[-+].*//') + if ! echo "$PLIST_VERSION" | grep -Eq '^[0-9]+(\.[0-9]+){0,2}$'; then + echo "::error::Invalid plist version '$PLIST_VERSION' derived from Cargo version '$VERSION'. Expected numeric x[.y[.z]]." + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "plist_version=$PLIST_VERSION" >> "$GITHUB_OUTPUT" + echo "build_number=${{ github.run_number }}" >> "$GITHUB_OUTPUT" + echo "Extracted version: $VERSION (plist: $PLIST_VERSION, build: ${{ github.run_number }})" + - name: Initial disk cleanup run: | echo "Disk usage before initial cleanup:" @@ -563,9 +601,9 @@ jobs: CFBundleDisplayName Dash Evo Tool CFBundleVersion - 1.0.0 + ${{ steps.version.outputs.build_number }} CFBundleShortVersionString - 1.0.0 + ${{ steps.version.outputs.plist_version }} CFBundlePackageType APPL CFBundleSignature diff --git a/flatpak/org.dash.DashEvoTool.metainfo.xml b/flatpak/org.dash.DashEvoTool.metainfo.xml index ca5049c72..31d5b20f4 100644 --- a/flatpak/org.dash.DashEvoTool.metainfo.xml +++ b/flatpak/org.dash.DashEvoTool.metainfo.xml @@ -43,6 +43,7 @@ Dash Core Group +