Skip to content

fix: default_pipeline #161

fix: default_pipeline

fix: default_pipeline #161

Workflow file for this run

name: install
on:
push:
tags:
- "v*"
branches:
- "**"
paths:
- ".github/workflows/install.yml"
- "assets/**"
- "**.py"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/install.yml"
- "assets/**"
- "**.py"
workflow_dispatch:
permissions:
contents: write
actions: write
jobs:
meta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: set_tag
run: |
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
tag=$(git describe --tags --match "v*" ${{ github.ref }} || true)
if [[ $tag != v* ]]; then
tag=$(curl -sX GET "https://api.github.com/repos/${{ github.repository }}/releases/latest" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | awk '/tag_name/{print $4}' FS='["]')
if [[ $tag != v* ]]; then
tag="v0.0.0"
fi
tag=$(date "+$tag-%y%m%d-$(git rev-parse --short HEAD)")
fi
if ! $($is_release) ; then
prefix=${tag%-*-*}
suffix=${tag#$prefix-}
tag="$prefix-ci.$suffix"
fi
is_prerelease=false
if [[ $tag =~ .*alpha.* || $tag =~ .*beta.* || $tag =~ .*rc.* || $tag =~ .*dev.* || $tag =~ .*-ci.* ]]; then
is_prerelease=true
fi
echo tag=$tag | tee -a $GITHUB_OUTPUT
echo is_release=$is_release | tee -a $GITHUB_OUTPUT
echo is_prerelease=$is_prerelease | tee -a $GITHUB_OUTPUT
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
is_release: ${{ steps.set_tag.outputs.is_release }}
is_prerelease: ${{ steps.set_tag.outputs.is_prerelease }}
windows:
needs: meta
runs-on: windows-latest
strategy:
matrix:
arch: [aarch64, x86_64]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download MaaFramework
uses: robinraju/release-downloader@v1
with:
repository: MaaXYZ/MaaFramework
fileName: "MAA-win-${{ matrix.arch }}*"
latest: true
preRelease: true
out-file-path: "deps"
extract: true
- name: Download MFAAvalonia
uses: robinraju/release-downloader@v1
with:
repository: SweetSmellFox/MFAAvalonia
fileName: "MFAAvalonia-*-win-x64*"
latest: true
out-file-path: "MFA"
extract: true
- name: Install
shell: bash
run: |
python ./install.py ${{ needs.meta.outputs.tag }}
cp MFA/MFAAvalonia.exe MFA/MFAUpdater.exe MFA/MFAUpdater.dll MFA/MFAUpdater.runtimeconfig.json MFA/av_libglesv2.dll MFA/libHarfBuzzSharp.dll MFA/libonigwrap.dll MFA/libSkiaSharp.dll MFA/uiohook.dll install/
mv install/MFAAvalonia.exe install/MaaJR.exe
cp logo.ico install
- uses: actions/upload-artifact@v4
with:
name: MaaJR-win-${{ matrix.arch }}
path: "install"
unix:
needs: meta
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
arch: [aarch64, x86_64]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download MaaFramework
uses: robinraju/release-downloader@v1
with:
repository: MaaXYZ/MaaFramework
fileName: "MAA-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'macos' }}-${{ matrix.arch }}*"
latest: true
preRelease: true
out-file-path: "deps"
extract: true
- name: Download MFAAvalonia
uses: robinraju/release-downloader@v1
with:
repository: SweetSmellFox/MFAAvalonia
fileName: "MFAAvalonia-*-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'osx' }}-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}*"
latest: true
out-file-path: "MFA"
extract: true
- name: Install
shell: bash
run: |
python ./install.py ${{ needs.meta.outputs.tag }}
platform_name="${{ matrix.os == 'ubuntu-latest' && 'linux' || 'macos' }}"
# Create list of MFA files to copy
mfa_files=$(ls -A MFA)
# Copy MFA files to install directory, skipping if they already exist
for file in $mfa_files; do
cp -n MFA/$file install/ 2>/dev/null || true
done
- uses: actions/upload-artifact@v4
with:
name: MaaJR-${{ matrix.os == 'ubuntu-latest' && 'linux' || 'macos' }}-${{ matrix.arch }}
path: "install"
changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: .github/cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}
release:
if: ${{ needs.meta.outputs.is_release == 'true' }}
needs: [meta, windows, unix, changelog]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: assets
- name: Check assets directory
run: |
ls -la assets
if [ -z "$(ls -A assets)" ]; then
echo "assets directory is empty"
exit 1
fi
- name: Compress and generate checksums
run: |
cd assets
echo "Generating checksums for all zip files..."
checksum_file="checksums.sha256"
touch "$checksum_file"
for f in *; do
if [ -d "$f" ]; then
echo "Processing directory: $f"
zip_file="$f-${{ needs.meta.outputs.tag }}.zip"
(cd "$f" && zip -r "../$zip_file" .)
if [ $? -eq 0 ]; then
echo "ZIP file created: ../$zip_file"
echo "Processing directory: $f"
sha256sum "$zip_file" >> "$checksum_file"
echo "" >> "$checksum_file"
else
echo "Failed to create ZIP file: ../$zip_file"
exit 1
fi
else
echo "Skipping non-directory: $f"
fi
done
- uses: softprops/action-gh-release@v2
with:
files: assets/*
tag_name: ${{ needs.meta.outputs.tag }}
body: ${{ needs.changelog.outputs.release_body }}
draft: false
prerelease: ${{ needs.meta.outputs.is_prerelease == 'true' }}
- name: Trigger MirrorChyanUploading
run: |
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan
gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}