Skip to content

Update update_assets.yml #595

Update update_assets.yml

Update update_assets.yml #595

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build Release
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
#pull_request:
# branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
setup:
name: Update Assets
# Set machine up, clone repo
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: actions-marketplace-validations/curoky_cleanup-disk-action@master
with:
retain: "python,node"
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 50
- name: setup python
uses: actions/setup-python@v2
with:
python-version: "3.9" #install the python needed
- name: Install hub
run: |
latest_hub_version=$(curl -s https://api.github.com/repos/github/hub/releases/latest | jq -r '.tag_name' | sed 's/v//')
hub_download_url="https://github.com/github/hub/releases/download/v${latest_hub_version}/hub-linux-amd64-${latest_hub_version}.tgz"
curl -L "$hub_download_url" | tar xz
sudo mv hub-linux-amd64-${latest_hub_version}/bin/hub /usr/local/bin/hub
# Optimize images
- name: Optimize images
run: |
# git fetch --tags --depth=50
sudo apt install -y optipng
python scripts/optimize.py
git config --global user.name 'Buildbot'
git config --global user.email '[email protected]'
git add .
git commit -m "Optimize images"
git push origin main
# Run assets build logic
- name: execute py script
run: |
python gen_config.py
- name: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'Buildbot'
git config --global user.email '[email protected]'
find . -name "*~" -type f -delete
# sudo apt-get install optipng
# find games/ -name '*.png' -print0 | xargs -0 optipng -strip all
git add .
git commit -m "Update assets"
git push origin main
set -x
assets=()
for asset in $(find . -name "*.7z*"); do
assets+=("-a" "${asset}")
done
hub release create "${assets[@]}" -m "${GITHUB_SHA::8}" "${GITHUB_SHA::8}"