cegcc-build/.github/workflows/build.yml
2022-04-11 13:30:48 +09:00

75 lines
2.2 KiB
YAML

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 and create dir
run: sudo chown "$(whoami):$(whoami)" /opt && mkdir /opt/cegcc
- name: Workaround for apt update failure
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
- name: Install deps
run: |
sudo apt update
sudo apt install build-essential bison flex m4 libgmp-dev libmpc-dev libmpfr-dev
- name: Build cegcc
run: |
mkdir build
cd build
../build.sh -j4
- name: Setup releases
id: release_name
run: |
export DIR=$(pwd)
ls -l /opt/cegcc/
cd /opt
zip -r $DIR/cegcc.zip cegcc
- name: Generate archive name
id: archive_name
run: echo ::set-output name=name::cegcc-${GITHUB_REF/refs\/*s\//}
- name: Upload cegcc.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: cegcc.zip
asset_name: ${{ steps.archive_name.outputs.name }}.zip
asset_content_type: application/zip