添加GitHub Actions Ci

This commit is contained in:
Stars_Kim 2020-05-09 16:05:33 +08:00 committed by GitHub
parent 5ba2f03206
commit beeeab869d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 0 deletions

46
.github/workflows/Typecho-dev-Ci.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Typecho Build Dev Ci
on: [push, pull_request]
jobs:
php:
name: PHP ${{ matrix.php }} Tests
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
fail-fast: false
matrix:
php: ['7.0','7.2', '7.3', '7.4']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP only
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Test
run: |
cd ./tools/
make test
build:
name: Typecho Build
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install tree
run: sudo apt-get -y install tree
- name: Build
run: |
cd ./tools/
make update
make rm
mkdir build/usr/uploads/
chmod 777 build/usr/uploads/
tree -d build
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: typecho_build
path: ./tools/build/

View File

@ -0,0 +1,35 @@
name: Typecho Build Release Ci
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
cd ./tools/
make all
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Typecho ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tools/build.tar.gz
asset_name: Typecho-build.tar.gz
asset_content_type: application/gzip