From 3d8b3deb7490cd8f389bdd7da7cc027cce7add04 Mon Sep 17 00:00:00 2001 From: objz Date: Mon, 27 Apr 2026 12:32:31 +0200 Subject: [PATCH] ci: fixed aur checksums and workflows --- .github/workflows/build.yml | 2 + .github/workflows/publish-chocolatey.yml | 11 ++- .github/workflows/publish-crates.yml | 20 ++++- .github/workflows/publish-winget.yml | 101 ++++++++++++----------- .github/workflows/release.yml | 62 ++++++++++++-- pkg/mcl-launcher-bin/PKGBUILD | 4 +- 6 files changed, 141 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80d35ee..f5614b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,8 @@ jobs: - name: install Rust uses: dtolnay/rust-toolchain@stable + with: + components: clippy - name: install JDK uses: actions/setup-java@v5 diff --git a/.github/workflows/publish-chocolatey.yml b/.github/workflows/publish-chocolatey.yml index 5454673..6889c39 100644 --- a/.github/workflows/publish-chocolatey.yml +++ b/.github/workflows/publish-chocolatey.yml @@ -16,12 +16,21 @@ jobs: env: PLAN: ${{ inputs.plan }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} steps: - uses: actions/checkout@v6 with: ref: ${{ fromJson(inputs.plan).announcement_tag }} + - name: verify Chocolatey publishing secret + shell: bash + run: | + if [ -z "${CHOCOLATEY_API_KEY}" ]; then + echo "::error::CHOCOLATEY_API_KEY is required to publish mcl-launcher to Chocolatey." + exit 1 + fi + - name: prepare Chocolatey package id: package shell: bash @@ -50,4 +59,4 @@ jobs: - name: push Chocolatey package uses: crazy-max/ghaction-chocolatey@v4 with: - args: push target/chocolatey/out/mcl-launcher.${{ steps.package.outputs.version }}.nupkg --source "https://push.chocolatey.org/" --api-key "${{ secrets.CHOCOLATEY_API_KEY }}" + args: push target/chocolatey/out/mcl-launcher.${{ steps.package.outputs.version }}.nupkg --source "https://push.chocolatey.org/" --api-key "${{ secrets.CHOCOLATEY_API_KEY }}" --timeout 2700 diff --git a/.github/workflows/publish-crates.yml b/.github/workflows/publish-crates.yml index 4f6ab0d..85d8b4d 100644 --- a/.github/workflows/publish-crates.yml +++ b/.github/workflows/publish-crates.yml @@ -1,11 +1,24 @@ name: publish crates on: + workflow_dispatch: + inputs: + plan: + required: true + type: string + dry_run: + required: false + type: boolean + default: true workflow_call: inputs: plan: required: true type: string + dry_run: + required: false + type: boolean + default: false permissions: contents: read @@ -23,6 +36,11 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: publish to crates.io - run: cargo publish --allow-dirty + run: | + if [ "${{ inputs.dry_run }}" = "true" ]; then + cargo publish --allow-dirty --dry-run + else + cargo publish --allow-dirty + fi env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/publish-winget.yml b/.github/workflows/publish-winget.yml index ee78ee8..12b6928 100644 --- a/.github/workflows/publish-winget.yml +++ b/.github/workflows/publish-winget.yml @@ -35,59 +35,62 @@ jobs: Invoke-WebRequest -Uri $checksumUrl -OutFile "$packagePath/$checksumFile" $checksum = (((Get-Content "$packagePath/$checksumFile" -Raw) -split '\s+')[0]).ToUpperInvariant() - $versionManifest = @" - PackageIdentifier: $identifier - PackageVersion: $version - DefaultLocale: en-US - ManifestType: version - ManifestVersion: 1.9.0 - "@ + $versionManifest = @( + '# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.9.0.schema.json' + "PackageIdentifier: $identifier" + "PackageVersion: $version" + 'DefaultLocale: en-US' + 'ManifestType: version' + 'ManifestVersion: 1.9.0' + ) -join "`n" $versionManifest | Set-Content -Path "$packagePath/$identifier.yaml" -Encoding utf8 - $installerManifest = @" - PackageIdentifier: $identifier - PackageVersion: $version - InstallerType: wix - Scope: machine - InstallerSwitches: - Silent: /quiet /norestart - SilentWithProgress: /passive /norestart - UpgradeBehavior: install - Commands: - - mcl - Installers: - - Architecture: x64 - InstallerUrl: $installerUrl - InstallerSha256: $checksum - ManifestType: installer - ManifestVersion: 1.9.0 - "@ + $installerManifest = @( + '# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.9.0.schema.json' + "PackageIdentifier: $identifier" + "PackageVersion: $version" + 'InstallerType: wix' + 'Scope: machine' + 'InstallerSwitches:' + ' Silent: /quiet /norestart' + ' SilentWithProgress: /passive /norestart' + 'UpgradeBehavior: install' + 'Commands:' + '- mcl' + 'Installers:' + '- Architecture: x64' + " InstallerUrl: $installerUrl" + " InstallerSha256: $checksum" + 'ManifestType: installer' + 'ManifestVersion: 1.9.0' + ) -join "`n" $installerManifest | Set-Content -Path "$packagePath/$identifier.installer.yaml" -Encoding utf8 - $localeManifest = @" - PackageIdentifier: $identifier - PackageVersion: $version - PackageLocale: en-US - Publisher: objz - PublisherUrl: https://github.com/objz - PublisherSupportUrl: https://github.com/objz/mcl/issues - Author: objz - PackageName: mcl-launcher - PackageUrl: https://github.com/objz/mcl - License: GPL-3.0-only - LicenseUrl: https://github.com/objz/mcl/blob/master/LICENSE - Copyright: Copyright (c) objz - ShortDescription: Minecraft launcher TUI - Description: A fully featured Minecraft launcher TUI with Microsoft account authentication, instance management, mod loaders, imports, content management, and launch support. - Moniker: mcl - Tags: - - minecraft - - launcher - - cli - - tui - ManifestType: defaultLocale - ManifestVersion: 1.9.0 - "@ + $localeManifest = @( + '# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.9.0.schema.json' + "PackageIdentifier: $identifier" + "PackageVersion: $version" + 'PackageLocale: en-US' + 'Publisher: objz' + 'PublisherUrl: https://github.com/objz' + 'PublisherSupportUrl: https://github.com/objz/mcl/issues' + 'Author: objz' + 'PackageName: mcl-launcher' + 'PackageUrl: https://github.com/objz/mcl' + 'License: GPL-3.0-only' + 'LicenseUrl: https://github.com/objz/mcl/blob/master/LICENSE' + 'Copyright: Copyright (c) objz' + 'ShortDescription: Minecraft launcher TUI' + 'Description: A fully featured Minecraft launcher TUI with Microsoft account authentication, instance management, mod loaders, imports, content management, and launch support.' + 'Moniker: mcl' + 'Tags:' + '- minecraft' + '- launcher' + '- cli' + '- tui' + 'ManifestType: defaultLocale' + 'ManifestVersion: 1.9.0' + ) -join "`n" $localeManifest | Set-Content -Path "$packagePath/$identifier.locale.en-US.yaml" -Encoding utf8 Remove-Item "$packagePath/$checksumFile" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fecdb6b..b34845d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -107,7 +107,7 @@ jobs: # Typically there will be: # - 1 "global" task that builds universal installers # - N "local" tasks that build each platform's binaries and platform-specific installers - matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} + matrix: ${{ fromJson(needs.plan.outputs.val || '{"ci":{"github":{"artifacts_matrix":{"include":[]}}}}').ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} container: ${{ matrix.container && matrix.container.image || null }} env: @@ -272,8 +272,8 @@ jobs: merge-multiple: true - name: Cleanup run: | - # Remove the granular manifests - rm -f artifacts/*-dist-manifest.json + # Remove internal cargo-dist manifests from the public GitHub Release. + rm -f artifacts/*-dist-manifest.json artifacts/dist-manifest.json - name: Generate changelog id: changelog uses: orhun/git-cliff-action@v4 @@ -287,8 +287,32 @@ jobs: ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}" RELEASE_COMMIT: "${{ github.sha }}" CHANGELOG: "${{ steps.changelog.outputs.content }}" + RELEASE_TAG: "${{ needs.plan.outputs.tag }}" run: | echo "$CHANGELOG" > $RUNNER_TEMP/notes.txt + cat >> $RUNNER_TEMP/notes.txt </dev/null; then + echo "::error::RELEASE_TOKEN cannot access ${HOMEBREW_TAP_REPOSITORY}. Create the tap repository or update RELEASE_TOKEN with access to it." + exit 1 + fi + - uses: actions/checkout@v6 with: persist-credentials: true - repository: "objz/homebrew-tap" + repository: ${{ env.HOMEBREW_TAP_REPOSITORY }} token: ${{ secrets.RELEASE_TOKEN }} # So we have access to the formula - name: Fetch homebrew formulae @@ -322,6 +361,7 @@ jobs: run: | git config --global user.name "${GITHUB_USER}" git config --global user.email "${GITHUB_EMAIL}" + starting_commit="$(git rev-parse HEAD)" for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output) @@ -334,9 +374,18 @@ jobs: brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true git add "Formula/${filename}" - git commit -m "${name} ${version}" + if git diff --cached --quiet; then + echo "Formula/${filename} is unchanged" + else + git commit -m "${name} ${version}" + fi done - git push + + if [ "$(git rev-parse HEAD)" = "$starting_commit" ]; then + echo "No Homebrew formula changes to push" + else + git push + fi custom-publish-crates: needs: @@ -346,6 +395,7 @@ jobs: uses: ./.github/workflows/publish-crates.yml with: plan: ${{ needs.plan.outputs.val }} + dry_run: false secrets: inherit # publish jobs get escalated permissions permissions: diff --git a/pkg/mcl-launcher-bin/PKGBUILD b/pkg/mcl-launcher-bin/PKGBUILD index f9d74a2..a3d8b60 100644 --- a/pkg/mcl-launcher-bin/PKGBUILD +++ b/pkg/mcl-launcher-bin/PKGBUILD @@ -10,8 +10,8 @@ depends=() provides=('mcl-launcher') conflicts=('mcl-launcher' 'mcl-launcher-git') source=("LICENSE-${pkgver}::${url}/raw/v${pkgver}/LICENSE" "README-${pkgver}::${url}/raw/v${pkgver}/README.md") -source_x86_64=("${url}/releases/download/v${pkgver}/mcl-launcher-x86_64-unknown-linux-gnu.tar.xz") -source_aarch64=("${url}/releases/download/v${pkgver}/mcl-launcher-aarch64-unknown-linux-gnu.tar.xz") +source_x86_64=("mcl-launcher-${pkgver}-x86_64-unknown-linux-gnu.tar.xz::${url}/releases/download/v${pkgver}/mcl-launcher-x86_64-unknown-linux-gnu.tar.xz") +source_aarch64=("mcl-launcher-${pkgver}-aarch64-unknown-linux-gnu.tar.xz::${url}/releases/download/v${pkgver}/mcl-launcher-aarch64-unknown-linux-gnu.tar.xz") sha256sums=('SKIP' 'SKIP') sha256sums_x86_64=('SKIP') sha256sums_aarch64=('SKIP')