Add GitHub Actions workflow definition

This commit is contained in:
Takumi Sueda 2022-04-12 01:00:24 +09:00
parent 45349a6dcf
commit 5c9db6bf08

74
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,74 @@
name: Build
on:
push:
branches: 'ci*'
tags: '*'
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: false
- name: Generate release name
id: release_name
# https://github.community/t/how-to-get-just-the-tag-name/16241/4
run: echo ::set-output name=name::${GITHUB_REF/refs\/*s\//}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_name.outputs.name }}
release_name: ${{ steps.release_name.outputs.name }}
body: ''
draft: false
prerelease: true
build:
name: Build
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Make /opt writable
run: sudo chown "$(whoami):$(whoami)" /opt
- name: Install cegcc
run: |
wget -O cegcc.zip https://github.com/brain-hackers/cegcc-build/releases/download/2022-04-11-133546/cegcc-2022-04-11-133546.zip
unzip -q cegcc.zip
cp -r cegcc /opt/
- name: Build brainlilo
env:
PREFIX: /opt/cegcc
run: make
- name: Setup releases
id: release_name
run: |
mkdir BrainLILO
touch BrainLILO/index.din
cp BrainLILO.dll BrainLILO/
cp BrainLILODrv.dll BrainLILO/
cp BrainLILO.exe BrainLILO/AppMain.exe
zip -r brainlilo.zip BrainLILO
- name: Generate archive name
id: archive_name
run: echo ::set-output name=name::brainlilo-${GITHUB_REF/refs\/*s\//}
- name: Upload brainlilo.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: brainlilo.zip
asset_name: ${{ steps.archive_name.outputs.name }}.zip
asset_content_type: application/zip