Skip to content

novel impr

novel impr #308

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
tags:
- v*.*.*
pull_request:
branches: [ master ]
workflow_dispatch:
env:
ORIGINAL_PROJECT: "CeuiLiSA/Pixiv-Shaft"
jobs:
build:
name: Build apk
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}
- name: Clone repo
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build debug apk
uses: eskatos/gradle-command-action@v1
with:
arguments: assembleDebug
distributions-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
- name: Upload artifact
uses: actions/upload-artifact@v2
if: ${{ !github.head_ref }}
with:
name: apk-debug
path: app/build/outputs/apk/debug
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/') && github.repository == env.ORIGINAL_PROJECT
id: get_tag_name
run: |
set -x
version_tag=${GITHUB_REF/refs\/tags\//}
version_tag_short=`echo $version_tag | awk 'NR==1,/v/{sub(/v/, "");print}'`
echo "VERSION_TAG=$version_tag" >> $GITHUB_ENV
echo "VERSION_TAG_SHORT=$version_tag_short" >> $GITHUB_ENV
- name: Build release apk
if: startsWith(github.ref, 'refs/tags/') && github.repository == env.ORIGINAL_PROJECT
uses: eskatos/gradle-command-action@v1
with:
arguments: assembleRelease
distributions-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
- name: Deal with release apk
if: startsWith(github.ref, 'refs/tags/') && github.repository == env.ORIGINAL_PROJECT
run: |
cp app/build/outputs/apk/release/app-release.apk app-release.apk
cp app-release.apk PixShaft_$VERSION_TAG_SHORT.apk
sha1=`sha1sum app-release.apk | awk '{ print toupper($1) }'`
sha256=`sha256sum app-release.apk | awk '{ print toupper($1) }'`
echo "APK_SHA1=$sha1" >> $GITHUB_ENV
echo "APK_SHA256=$sha256" >> $GITHUB_ENV
- name: Draft release
if: startsWith(github.ref, 'refs/tags/') && github.repository == env.ORIGINAL_PROJECT
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION_TAG }}
name: ${{ env.VERSION_TAG }}
body: |
# 更新内容
### 新增
*
*
### 修改
*
*
### 修复
*
*
```
SHA-1: ${{ env.APK_SHA1 }}
SHA-256: ${{ env.APK_SHA256 }}
```
files: |
PixShaft_${{env.VERSION_TAG_SHORT}}.apk
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}