Skip to content

nightly build

nightly build #238

Workflow file for this run

name: nightly build
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
checkLastCommit:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: print latest_commit
run: echo ${{ github.sha }}
- name: Get Last Commit Date
id: commit_date
run: |
LAST_COMMIT_DATE=$(git log -1 --format=%ct)
echo "LAST_COMMIT_DATE=${LAST_COMMIT_DATE}" >> $GITHUB_ENV
- name: Calculate Time Difference
id: time_diff
run: |
CURRENT_DATE=$(date +%s)
TIME_DIFF=$((CURRENT_DATE - LAST_COMMIT_DATE))
echo "TIME_DIFF=${TIME_DIFF}" >> $GITHUB_ENV
- name: Check Last Commit
run: |
if [[ $TIME_DIFF -gt $((60*60*24*7)) ]]; then
echo "Last commit is older than a week."
echo "is_old_commit=true" >> $GITHUB_OUTPUT
else
echo "Last commit is within the past week."
echo "is_old_commit=false" >> $GITHUB_OUTPUT
fi
build:
name: Build
runs-on: ubuntu-latest
needs: checkLastCommit
if: ${{ needs.checkLastCommit.outputs.is_old_commit == false }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Yarn
uses: threeal/[email protected]
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Install dependencies
run: yarn; git submodule update --init --recursive
- name: 'Create env file'
run: |
echo "${{ secrets.ENV_FILE }}" > .env
- name: yarn build
run: |
yarn build
zip -r NoxPlayer.zip build
- name: pack crx
uses: cardinalby/webext-buildtools-chrome-crx-action@v2
with:
# zip file made at the packExtensionDir step
zipFilePath: 'NoxPlayer.zip'
crxFilePath: 'NoxPlayer.crx'
privateKey: ${{ secrets.PEM_KEY }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: nightly-${{ steps.date.outputs.date }}
files: |
NoxPlayer.zip
NoxPlayer.crx
prerelease: true