2021-02-26 15:57:47 +00:00
|
|
|
name: release_beta_to_dev
|
2021-03-27 07:04:24 +00:00
|
|
|
on: workflow_dispatch
|
2021-02-26 15:57:47 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
2021-06-20 16:16:39 +00:00
|
|
|
STATUS_WORKFLOW_NAME: "ci.yml"
|
2021-03-27 05:48:12 +00:00
|
|
|
UI_DIRECTORY: ./frontend
|
2021-03-27 12:10:36 +00:00
|
|
|
ASSET_DIRECTORY: ./__builds__
|
2021-03-27 05:48:12 +00:00
|
|
|
FETCH_DEPTH: 15 # Should be enough
|
2021-02-26 15:57:47 +00:00
|
|
|
steps:
|
2021-03-27 12:07:27 +00:00
|
|
|
- name: Validate branch
|
|
|
|
if: ${{ github.ref != 'refs/heads/development' }}
|
|
|
|
run: |
|
|
|
|
echo This action can only be run on development branch, not ${{ github.ref }}
|
|
|
|
exit 1
|
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- name: Checkout
|
2022-03-07 22:18:06 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-02-26 15:57:47 +00:00
|
|
|
with:
|
2021-03-27 05:48:12 +00:00
|
|
|
fetch-depth: ${{ env.FETCH_DEPTH }}
|
2021-02-26 15:57:47 +00:00
|
|
|
ref: development
|
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- name: Setup Git
|
|
|
|
run: |
|
|
|
|
git config --global user.name "github-actions" &&
|
|
|
|
git fetch --depth ${{ env.FETCH_DEPTH }} --tags
|
|
|
|
|
|
|
|
- name: Cache node_modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: '${{ env.UI_DIRECTORY }}/node_modules'
|
|
|
|
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: ${{ runner.os }}-modules-
|
|
|
|
|
2021-02-26 15:57:47 +00:00
|
|
|
- name: Setup NodeJS
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-03-25 14:22:43 +00:00
|
|
|
node-version: "15.x"
|
2021-03-26 00:43:31 +00:00
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- name: Install Global Tools
|
2021-05-08 16:06:52 +00:00
|
|
|
run: npm install -g release-it auto-changelog
|
2021-03-25 14:22:43 +00:00
|
|
|
|
2021-03-27 05:48:12 +00:00
|
|
|
- name: Install UI Dependencies
|
|
|
|
run: npm install
|
|
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
2021-02-26 15:57:47 +00:00
|
|
|
|
2021-05-08 16:06:52 +00:00
|
|
|
- name: Build UI
|
|
|
|
run: npm run build
|
2021-03-27 05:48:12 +00:00
|
|
|
working-directory: ${{ env.UI_DIRECTORY }}
|
2021-03-27 12:10:36 +00:00
|
|
|
|
2021-06-23 13:23:46 +00:00
|
|
|
- name: Validate CI
|
|
|
|
id: check-ci
|
2021-06-24 16:04:59 +00:00
|
|
|
uses: LASER-Yi/workflow-status@v0.1.0
|
2021-06-23 13:23:46 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
workflow: ci.yml
|
|
|
|
event: push
|
|
|
|
branch: development
|
|
|
|
|
2021-04-19 02:42:41 +00:00
|
|
|
- name: Create Release (Conditional)
|
2021-06-23 13:23:46 +00:00
|
|
|
if: ${{ steps.check-ci.outputs.conclusion == 'success' }}
|
2021-04-04 12:01:44 +00:00
|
|
|
run: |
|
2021-07-01 11:53:03 +00:00
|
|
|
revision_count=$(git rev-list --invert-grep --regexp-ignore-case --extended-regexp --grep="^(Release|no log:|Merge.remote-tracking).*" $(git describe --tags --abbrev=0)..HEAD --count)
|
2021-04-19 02:42:41 +00:00
|
|
|
if [[ $revision_count != 0 ]]; then
|
|
|
|
echo "**** Found $revision_count changes! Releasing... ****"
|
|
|
|
release-it --ci --increment prerelease --preRelease=beta
|
|
|
|
else
|
|
|
|
echo "**** Cannot find changes! Skipping... ****"
|
|
|
|
fi
|