Skip to content

CI: Update ci workflow and makefile #14

CI: Update ci workflow and makefile

CI: Update ci workflow and makefile #14

name: Build Zeal 8-bit OS
on:
push:
branches:
- '*'
tags:
- v*
pull_request:
types:
- opened
- reopened
jobs:
deploy:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout from git
uses: actions/checkout@v3
with:
submodules: 'true' # future use
fetch-depth: 0
- name: Install prerequisites
shell: bash
run: |
sudo snap remove z88dk
sudo snap install --edge z88dk
sudo snap alias z88dk.z88dk-z80asm z88dk-z80asm
sudo apt update
sudo apt install -y jq make lftp git python3 python3-pip
pip3 install --ignore-installed --user kconfiglib
- name: Build Zeal 8-bit OS (zeal8bit target)
shell: bash
run: |
make alldefconfig
z88dk-z80asm
make
mv build/os_with_romdisk.img build/$(git describe --tags).img
- name: Update index.json
if: ${{ github.repository_owner == 'Zeal8bit' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
wget $CONF_SERVER/roms/index.json
export NAME=$(git describe --tags)
export SHA=$(sha256sum -b build/*.img | cut -f1 -d' ')
jq ".nightly += [.latest] | .latest = {\"name\" : \"$NAME\", \
\"urls\" : \"$CONF_SERVER/roms/$NAME.img\", \
\"version\" : \"$NAME/\", \
\"hash\": \"$SHA\"}" < index.json > index_new.json
mv index_new.json index.json
env:
CONF_SERVER: ${{ secrets.ZEAL8BIT_CONF_SITE }}
- name: Setup SSH
if: ${{ github.repository_owner == 'Zeal8bit' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
mkdir -p ~/.ssh
echo "StrictHostKeyChecking no" > ~/.ssh/config
echo "$RUNNER_SSH_PRIV" > ~/.ssh/id_rsa
echo "$RUNNER_SSH_PUB" > ~/.ssh/id_rsa.pub
sudo sh -c 'echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config'
env:
RUNNER_SSH_PUB: ${{ secrets.ZEAL8BIT_SSH_PUB }}
RUNNER_SSH_PRIV: ${{ secrets.ZEAL8BIT_SSH_PRIV }}
- name: Publish files
if: ${{ github.repository_owner == 'Zeal8bit' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
export NAME=$(git describe --tags).img
lftp --env-password -d sftp://$LFTP_USER@$LFTP_SERVER -e "set sftp:auto-confirm yes; put -e build/$NAME -o /htdocs/roms/$NAME; put -e index.json -o /htdocs/roms/index.json; bye"
env:
LFTP_USER: ${{ secrets.ZEAL8BIT_USER }}
LFTP_SERVER: ${{ secrets.ZEAL8BIT_SERVER }}
LFTP_PORT: ${{ secrets.ZEAL8BIT_PORT }}
LFTP_PASSWORD: ${{ secrets.ZEAL8BIT_PASS }}