Legacy-iOS-Kit/.github/workflows/build.yml
2023-01-17 10:19:51 +08:00

78 lines
3.0 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 ./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_x86_64_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip
${{ github.event.repository.name }}_windows_${{ env.DATE }}-${{ env.SHA_SHORT }}.zip