Skip to content

Instantly share code, notes, and snippets.

@ipcjs
Created June 6, 2022 08:16
Show Gist options
  • Save ipcjs/cf19ca535a857b602baba856e9ee510d to your computer and use it in GitHub Desktop.
Save ipcjs/cf19ca535a857b602baba856e9ee510d to your computer and use it in GitHub Desktop.
daily-build
{
"categories": [
{
"title": "## 🚀 Features",
"labels": [
"feature",
"feat"
]
},
{
"title": "## 🐛 Fixes",
"labels": [
"fix"
]
},
{
"title": "## ♻️ Refactors",
"labels": [
"refactor"
]
},
{
"title": "## 🧪 Tests",
"labels": [
"test"
]
}
],
"label_extractor": [
{
"pattern": "^(\\w+)(\\(\\w+\\))?: .*",
"target": "$1"
}
],
"template": "${{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
"pr_template": "- ${{TITLE}} - ${{AUTHOR}}(${{MERGE_SHA}})\n",
"tag_resolver": {
"method": "sort",
"filter": {
"pattern": "mt-(.+)"
}
}
}
name: Daily build
on:
push:
branches:
- feature/action
schedule:
- cron: '0 0 * * *'
defaults:
run:
working-directory: maintain
jobs:
# https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
# https://github.com/doxygen/doxygen/blob/master/.github/workflows/coverity.yml
check_date:
runs-on: ubuntu-20.04
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
build-android:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Generate tag
id: tag
run: |
tag="mt-$(date +%Y.%m.%d)"
echo "::set-output name=result::$tag"
- name: Generate Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitMode: true
configuration: ".github/workflows/daily-build-changelog-config.json"
toTag: ${{ github.sha }}
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Decode Keystore
id: keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE }}
run: |
KEYSTORE_FILE="${RUNNER_TEMP}/keystore.jks"
echo $ENCODED_STRING | base64 -di > "${KEYSTORE_FILE}"
echo "::set-output name=result::${KEYSTORE_FILE}"
- name: Build Android
run: |
flutter build apk --split-per-abi
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_STORE_FILE: ${{ steps.keystore.outputs.result }}
- name: Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "maintain/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk"
commit: ${{ github.sha }}
tag: ${{ steps.tag.outputs.result }}
body: ${{ steps.github_release.outputs.changelog }}
allowUpdates: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment