Add build.yml

This commit is contained in:
Takumi Sueda 2022-07-16 22:46:46 +09:00
parent 9f958410d2
commit b0d5844bb0

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

@ -0,0 +1,96 @@
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: Generate the tag name for a branch build
if: startsWith(steps.release_name.outputs.name, 'ci-')
run: |
echo "RELEASE_TAG_NAME=${GITHUB_REF/refs\/*s\//}-tag" >> $GITHUB_ENV
- name: Generate the tag name for a branch build
if: ! startsWith(steps.release_name.outputs.name, 'ci-')
run: |
echo "RELEASE_TAG_NAME=${GITHUB_REF/refs\/*s\//}" >> $GITHUB_ENV
- name: Generate changes file
uses: sarnold/gitchangelog-action@master
with:
config_file: .gitchangelog.rc
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_TAG_NAME }}
release_name: ${{ steps.release_name.outputs.name }}
body_path: CHANGES.md
draft: false
prerelease: true
# build-linux:
# runs-on: ubuntu-20.04
# needs: [create_release]
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: true
# - 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 libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap python3-pip
# - name: Upgrade pip and setuptools
# run: pip3 install -U pip setuptools
# - name: Install listconfig
# run: pip3 install listconfig
# - name: Configure for Linux
# run: make ldefconfig
# - name: Build Linux
# run: make lbuild
# - name: Setup releases
# id: release_name
# run: |
# mkdir release
# cp ./linux-brain/arch/arm/boot/dts/imx28-pwsh*.dtb release/
# cp ./linux-brain/arch/arm/boot/zImage release/zImage
# zip -r release.zip release/
# - name: Generate archive name
# id: archive_name
# run: echo ::set-output name=name::linux-${GITHUB_REF/refs\/*s\//}
# - name: Upload release.zip
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: release.zip
# asset_name: ${{ steps.archive_name.outputs.name }}.zip
# asset_content_type: application/zip
# - name: Generate listconfig
# run: listconfig ./linux-brain/Kconfig ./linux-brain/.config > listconfig
# - name: Upload listconfig
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: listconfig
# asset_name: listconfig
# asset_content_type: text/plain