mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
don't depend on build path + cleanup + renaming
This commit is contained in:
parent
922ed1bbba
commit
4f9bd4338d
3 changed files with 72 additions and 69 deletions
|
|
@ -171,7 +171,7 @@ done
|
||||||
|
|
||||||
# CI context (GitHub Actions provided environment variable)
|
# CI context (GitHub Actions provided environment variable)
|
||||||
if [[ -z ${RUNNER_OS:-} ]]; then
|
if [[ -z ${RUNNER_OS:-} ]]; then
|
||||||
echo "::notice::RUNNER_OS (GitHub Actions CI environment variable) is not available and OS-specific configuration will be skipped."
|
echo "::notice::RUNNER_OS (GitHub Actions CI environment variable) is not available and OS-specific build configuration will be skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Schema version consistency
|
# Schema version consistency
|
||||||
|
|
@ -320,15 +320,15 @@ fi
|
||||||
|
|
||||||
# ccache
|
# ccache
|
||||||
if [[ $USE_CCACHE == 1 ]]; then
|
if [[ $USE_CCACHE == 1 ]]; then
|
||||||
echo "::group::Clear ccache stats"
|
echo "::group::Show ccache configuration"
|
||||||
ccache --version
|
ccache --version
|
||||||
ccache --show-config
|
ccache --show-config
|
||||||
echo "---"
|
echo "---"
|
||||||
ccache --show-stats --verbose
|
ccache --show-stats
|
||||||
echo "---"
|
echo "---"
|
||||||
ccache --zero-stats # zero former cache statistics (but not the configuration options or the cache itself)
|
ccache --zero-stats
|
||||||
echo "---"
|
echo "---"
|
||||||
ccache --show-stats --verbose
|
ccache --show-stats
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -360,10 +360,10 @@ if [[ $USE_CCACHE == 1 ]]; then
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::group::Show ccache stats"
|
echo "::group::Show ccache statistics"
|
||||||
ccache --show-stats
|
ccache --show-stats --verbose
|
||||||
ccache --show-stats --verbose # too verbose?
|
echo "---"
|
||||||
ccache --show-compression # helpful?
|
ccache --show-compression
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
elif [[ -n $CCACHE_EVICTION_AGE ]]; then
|
elif [[ -n $CCACHE_EVICTION_AGE ]]; then
|
||||||
|
|
@ -410,7 +410,7 @@ if [[ $MAKE_PACKAGE == 1 ]]; then
|
||||||
|
|
||||||
if [[ -n $PACKAGE_SUFFIX ]]; then
|
if [[ -n $PACKAGE_SUFFIX ]]; then
|
||||||
echo "::group::Update package name"
|
echo "::group::Update package name"
|
||||||
BUILD_DIR="$BUILD_DIR" .ci/name_build.sh "$PACKAGE_SUFFIX"
|
.ci/name_build.sh "$PACKAGE_SUFFIX"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,52 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# used by the ci to rename build artifacts
|
|
||||||
# renames the file to [original name][SUFFIX].[original extension]
|
|
||||||
# where SUFFIX is either available in the environment or as the first arg
|
|
||||||
# expected to be run in the build directory unless BUILD_DIR is set
|
|
||||||
# adds output to GITHUB_OUTPUT
|
|
||||||
builddir="${BUILD_DIR:=.}"
|
|
||||||
findrx="Cockatrice-*.*"
|
|
||||||
|
|
||||||
if [[ $1 ]]; then
|
set -euo pipefail
|
||||||
SUFFIX="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check env
|
# Used by the CI build script to rename package artifacts
|
||||||
if [[ ! $SUFFIX ]]; then
|
#
|
||||||
echo "::error file=$0::SUFFIX is missing"
|
# Appends PACKAGE_SUFFIX to the package's filename
|
||||||
|
# <package> = <filename><extension>
|
||||||
|
# <package_new> = <filename><PACKAGE_SUFFIX><extension>
|
||||||
|
# PACKAGE_SUFFIX must be passed as the first argument to the script
|
||||||
|
# Adds output to GITHUB_OUTPUT
|
||||||
|
#
|
||||||
|
# Expected to be run in the repository root where CPack executes from and places its output binary
|
||||||
|
# Expects a single binary for package_pattern and picks the first match
|
||||||
|
# Expects <extension> to be e.g. ".dmg", ".deb" or ".exe" (".tar.gz" etc. with more than one dot will break)
|
||||||
|
|
||||||
|
# Initialize PACKAGE_SUFFIX from positional argument
|
||||||
|
PACKAGE_SUFFIX="${1:-}"
|
||||||
|
|
||||||
|
# Check variable
|
||||||
|
if [[ -z $PACKAGE_SUFFIX ]]; then
|
||||||
|
echo "::error file=$0::Missing required argument: PACKAGE_SUFFIX"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
package_pattern="Cockatrice-*.*"
|
||||||
|
|
||||||
# find file
|
# Find package in current directory
|
||||||
found="$(find "$builddir" -maxdepth 1 -type f -name "$findrx" -print -quit)"
|
package_path="$(find "$PWD" -maxdepth 1 -type f -name "$package_pattern" -print -quit)"
|
||||||
path="${found%/*}" # remove all including first "/" from right side
|
|
||||||
file="${found##*/}" # remove all including last "/" from left side
|
if [[ -z "$package_path" ]]; then
|
||||||
if [[ ! $file ]]; then
|
echo "::error file=$0::Could not find package"
|
||||||
echo "::error file=$0::could not find package"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
oldpwd="$PWD"
|
|
||||||
if ! cd "$path"; then
|
|
||||||
echo "::error file=$0::could not get file path"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set filename
|
# <package> = <filename><extension>
|
||||||
name="${file%.*}" # remove all including first "." from right side
|
package="${package_path##*/}" # remove folder path (keep e.g. "Cockatrice-3.0.0.deb")
|
||||||
new_name="$name$SUFFIX"
|
filename="${package%.*}" # remove extension (keep e.g. "Cockatrice-3.0.0")
|
||||||
extension="${file##*.}" # remove all including last "." from left side
|
extension=".${package##*.}" # remove filename (keep e.g. ".deb")
|
||||||
filename="$new_name.$extension"
|
|
||||||
echo "renaming '$file' to '$filename'"
|
|
||||||
mv "$file" "$filename"
|
|
||||||
|
|
||||||
cd "$oldpwd"
|
# Rename package (build artifact)
|
||||||
relative_path="$path/$filename"
|
filename_new="$filename$PACKAGE_SUFFIX"
|
||||||
ls -l "$relative_path"
|
package_new="$filename_new$extension"
|
||||||
echo "path=$relative_path" >>"$GITHUB_OUTPUT"
|
package_path_new="$PWD/$package_new"
|
||||||
echo "name=$new_name" >>"$GITHUB_OUTPUT"
|
|
||||||
echo "fullname=$filename" >>"$GITHUB_OUTPUT"
|
echo "Renaming '$package' to '$package_new'"
|
||||||
|
mv "$package_path" "$package_path_new"
|
||||||
|
du -h "$package_path_new"
|
||||||
|
|
||||||
|
echo "package_path=$package_path_new" >>"$GITHUB_OUTPUT"
|
||||||
|
echo "package=$package_new" >>"$GITHUB_OUTPUT"
|
||||||
|
echo "filename=$filename_new" >>"$GITHUB_OUTPUT"
|
||||||
|
|
|
||||||
40
.github/workflows/desktop-build.yml
vendored
40
.github/workflows/desktop-build.yml
vendored
|
|
@ -227,18 +227,18 @@ jobs:
|
||||||
with:
|
with:
|
||||||
archive: false
|
archive: false
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
path: ${{ steps.build.outputs.path }}
|
path: ${{ steps.build.outputs.package_path }}
|
||||||
|
|
||||||
- name: "Upload to release"
|
- name: "Upload to release"
|
||||||
id: upload_release
|
id: upload_release
|
||||||
if: matrix.package != 'skip' && needs.configure.outputs.tag != null
|
if: matrix.package != 'skip' && needs.configure.outputs.tag != null
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
asset_name: ${{ steps.build.outputs.fullname }}
|
package: ${{ steps.build.outputs.package }}
|
||||||
asset_path: ${{ steps.build.outputs.path }}
|
package_path: ${{ steps.build.outputs.package_path }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
tag_name: ${{ needs.configure.outputs.tag }}
|
tag_name: ${{ needs.configure.outputs.tag }}
|
||||||
run: gh release upload "$tag_name" "$asset_path#$asset_name"
|
run: gh release upload "$tag_name" "$package_path#$package"
|
||||||
|
|
||||||
- name: "Attest binary provenance"
|
- name: "Attest binary provenance"
|
||||||
id: attestation
|
id: attestation
|
||||||
|
|
@ -246,15 +246,15 @@ jobs:
|
||||||
uses: actions/attest@v4
|
uses: actions/attest@v4
|
||||||
with:
|
with:
|
||||||
show-summary: false
|
show-summary: false
|
||||||
subject-path: ${{ steps.build.outputs.path }}
|
subject-path: ${{ steps.build.outputs.package_path }}
|
||||||
|
|
||||||
- name: "Verify binary attestation"
|
- name: "Verify binary attestation"
|
||||||
if: steps.attestation.outcome == 'success'
|
if: steps.attestation.outcome == 'success'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
BUILD_PATH: ${{ steps.build.outputs.path }}
|
PACKAGE_PATH: ${{ steps.build.outputs.package_path }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: gh attestation verify "$BUILD_PATH" --repo Cockatrice/Cockatrice
|
run: gh attestation verify "$PACKAGE_PATH" --repo Cockatrice/Cockatrice
|
||||||
|
|
||||||
build-vcpkg:
|
build-vcpkg:
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -475,20 +475,20 @@ jobs:
|
||||||
if: matrix.os == 'macOS' && matrix.make_package && needs.configure.outputs.tag != null
|
if: matrix.os == 'macOS' && matrix.make_package && needs.configure.outputs.tag != null
|
||||||
id: sign_macos
|
id: sign_macos
|
||||||
env:
|
env:
|
||||||
BUILD_PATH: ${{ steps.build.outputs.path }}
|
PACKAGE_PATH: ${{ steps.build.outputs.package_path }}
|
||||||
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
||||||
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
||||||
run: |
|
run: |
|
||||||
if [[ -n "$MACOS_CERTIFICATE_NAME" ]]
|
if [[ -n "$MACOS_CERTIFICATE_NAME" ]]
|
||||||
then
|
then
|
||||||
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
|
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
|
||||||
/usr/bin/codesign --sign="$MACOS_CERTIFICATE_NAME" --entitlements=".ci/macos.entitlements" --options=runtime --force --deep --timestamp --verbose "$BUILD_PATH"
|
/usr/bin/codesign --sign="$MACOS_CERTIFICATE_NAME" --entitlements=".ci/macos.entitlements" --options=runtime --force --deep --timestamp --verbose "$PACKAGE_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: "[macOS] Notarize app bundle"
|
- name: "[macOS] Notarize app bundle"
|
||||||
if: matrix.os == 'macOS' && steps.sign_macos.outcome == 'success'
|
if: matrix.os == 'macOS' && steps.sign_macos.outcome == 'success'
|
||||||
env:
|
env:
|
||||||
BUILD_PATH: ${{ steps.build.outputs.path }}
|
PACKAGE_PATH: ${{ steps.build.outputs.package_path }}
|
||||||
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
|
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
|
||||||
MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
|
MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
|
||||||
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
|
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
|
||||||
|
|
@ -503,7 +503,7 @@ jobs:
|
||||||
# Therefore, we create a zip file containing our app bundle, so that we can send it to the
|
# Therefore, we create a zip file containing our app bundle, so that we can send it to the
|
||||||
# notarization service
|
# notarization service
|
||||||
echo "Creating temp notarization archive"
|
echo "Creating temp notarization archive"
|
||||||
ditto -c -k --keepParent "$BUILD_PATH" "notarization.zip"
|
ditto -c -k --keepParent "$PACKAGE_PATH" "notarization.zip"
|
||||||
|
|
||||||
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
|
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
|
||||||
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
|
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
|
||||||
|
|
@ -515,7 +515,7 @@ jobs:
|
||||||
# Finally, we need to "attach the staple" to our executable, which will allow our app to be
|
# Finally, we need to "attach the staple" to our executable, which will allow our app to be
|
||||||
# validated by macOS even when an internet connection is not available.
|
# validated by macOS even when an internet connection is not available.
|
||||||
echo "Attach staple"
|
echo "Attach staple"
|
||||||
xcrun stapler staple "$BUILD_PATH"
|
xcrun stapler staple "$PACKAGE_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: "Upload artifact"
|
- name: "Upload artifact"
|
||||||
|
|
@ -525,14 +525,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
archive: false
|
archive: false
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
path: ${{ steps.build.outputs.path }}
|
path: ${{ steps.build.outputs.package_path }}
|
||||||
|
|
||||||
- name: "[Windows] Upload PDBs (Program Databases)"
|
- name: "[Windows] Upload PDBs (Program Databases)"
|
||||||
if: matrix.os == 'Windows' && github.ref_type != 'tag'
|
if: matrix.os == 'Windows' && github.ref_type != 'tag'
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
name: ${{ steps.build.outputs.name }}-PDBs
|
name: ${{ steps.build.outputs.filename }}-PDBs
|
||||||
path: |
|
path: |
|
||||||
build/cockatrice/Release/*.pdb
|
build/cockatrice/Release/*.pdb
|
||||||
build/oracle/Release/*.pdb
|
build/oracle/Release/*.pdb
|
||||||
|
|
@ -543,11 +543,11 @@ jobs:
|
||||||
id: upload_release
|
id: upload_release
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
asset_name: ${{ steps.build.outputs.fullname }}
|
package: ${{ steps.build.outputs.package }}
|
||||||
asset_path: ${{ steps.build.outputs.path }}
|
package_path: ${{ steps.build.outputs.package_path }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
tag_name: ${{ needs.configure.outputs.tag }}
|
tag_name: ${{ needs.configure.outputs.tag }}
|
||||||
run: gh release upload "$tag_name" "$asset_path#$asset_name"
|
run: gh release upload "$tag_name" "$package_path#$package"
|
||||||
|
|
||||||
- name: "Attest binary provenance"
|
- name: "Attest binary provenance"
|
||||||
if: steps.upload_release.outcome == 'success'
|
if: steps.upload_release.outcome == 'success'
|
||||||
|
|
@ -555,12 +555,12 @@ jobs:
|
||||||
uses: actions/attest@v4
|
uses: actions/attest@v4
|
||||||
with:
|
with:
|
||||||
show-summary: false
|
show-summary: false
|
||||||
subject-path: ${{ steps.build.outputs.path }}
|
subject-path: ${{ steps.build.outputs.package_path }}
|
||||||
|
|
||||||
- name: "Verify binary attestation"
|
- name: "Verify binary attestation"
|
||||||
if: steps.attestation.outcome == 'success'
|
if: steps.attestation.outcome == 'success'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
BUILD_PATH: ${{ steps.build.outputs.path }}
|
PACKAGE_PATH: ${{ steps.build.outputs.package_path }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: gh attestation verify "$BUILD_PATH" --repo Cockatrice/Cockatrice
|
run: gh attestation verify "$PACKAGE_PATH" --repo Cockatrice/Cockatrice
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue