Legacy-iOS-Kit/.github/workflows/build.yml
2023-01-20 18:43:25 +08:00

87 lines
3.5 KiB
YAML

name: Create zip files
on:
push:
branches:
- main
jobs:
create-zip-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create name version env
run: |
sudo timedatectl set-timezone Asia/Singapore
echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
echo "SHA_SHORT=$(echo ${{ github.sha }} | cut -c -7)" >> $GITHUB_ENV
- name: Create git hash
run: echo "${{ env.DATE }}-${{ env.SHA_SHORT }}" | tee ./resources/git_hash
- name: Move linux binaries
run: |
mkdir -p ./exclude/lib ./exclude/bin
cp -R ./bin/* ./exclude/bin
cp ./resources/lib/* ./exclude/lib
rm -r ./bin/linux ./bin/windows ./resources/lib/*
- name: Zip macos files
run: zip -r ${{ github.event.repository.name }}_macos_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.sh README.md
- name: Move macos binaries
run: |
rm -r ./bin/macos
cp ./exclude/lib/* ./resources/lib
mkdir ./bin/linux
cp -R ./exclude/bin/linux/x86_64 ./bin/linux
- name: Zip linux files
run: zip -r ${{ github.event.repository.name }}_linux_x86_64_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.sh README.md
- name: Move linux binaries and other files
run: |
rm -r ./bin/linux/x86_64
cp -R ./exclude/bin/linux/arm64 ./bin/linux
- name: Zip linux arm64 files
run: zip -r ${{ github.event.repository.name }}_linux_arm64_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.sh README.md
- name: Move linux arm64 binaries and other files
run: |
rm -r ./bin/linux/arm64 ./resources/lib/*
cp -R ./exclude/bin/linux/arm ./bin/linux
- name: Zip linux arm files
run: zip -r ${{ github.event.repository.name }}_linux_arm_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.sh README.md
- name: Move linux arm binaries and other files
run: |
rm -r ./bin/linux
cp -R ./exclude/bin/windows ./bin
- name: Zip win files
run: zip -r ${{ github.event.repository.name }}_windows_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.cmd restore.sh README.md
- name: Copy exclude files back and download other files
run: |
cp -R ./exclude/bin/* ./bin
cp -R ./exclude/lib/* ./resources/lib
./resources/complete.sh
- name: Zip complete files
run: zip -r ${{ github.event.repository.name }}_complete_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip bin/ LICENSE resources/ restore.cmd restore.sh README.md
- name: Update latest release
uses: pyTooling/Actions/releaser@main
with:
tag: latest
rm: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ github.event.repository.name }}_complete_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip
${{ github.event.repository.name }}_macos_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip
${{ github.event.repository.name }}_linux_arm_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip
${{ github.event.repository.name }}_linux_arm64_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip
${{ github.event.repository.name }}_linux_x86_64_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip
${{ github.event.repository.name }}_windows_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip