Skip to content

stuff

stuff #26

Workflow file for this run

name: Combine and Zip Files
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
zip:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Set up zip and rsync
run: sudo apt-get install zip unzip rsync jq -y
- name: Unzip tweaks.zip
run: unzip tweaks.zip -d tweaks
- name: Copy repository files over tweaks files
run: rsync -av --exclude='tweaks.zip' --exclude='tweaks/' ./ tweaks/
- name: Create pack.zip excluding tweaks.zip and extracted tweaks folder
run: |
cd tweaks
zip -r ../pack.zip . -x "tweaks.zip" "tweaks/"
- name: Check the size of the created pack.zip
run: du -sh pack.zip
- name: Delete old pack.zip from the release (if exists)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_id=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/Main | jq -r .id)
asset_id=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases/$release_id/assets | jq -r '.[] | select(.name=="pack.zip") | .id')
if [ -n "$asset_id" ]; then
curl -s -X DELETE \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id
fi
- name: Upload pack.zip as a release asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_id=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/Main | jq -r .id)
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @pack.zip \
"https://uploads.github.com/repos/${{ github.repository }}/releases/$release_id/assets?name=pack.zip"