nightly build #131
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nightly build | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
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@v3 | |
- 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) | |
SECONDS_IN_WEEK=$((60*60*24)) | |
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)) ]]; 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@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: get custom react music player | |
run: git clone https://github.com/lovegaoshi/react-music-player.git Dependencies/react-jinke-music-player | |
- name: build rjmp | |
run: cd Dependencies/react-jinke-music-player && yarn && yarn build | |
- name: Install dependencies | |
run: yarn | |
- name: 'Create env file' | |
run: | | |
echo "${{ secrets.ENV_FILE }}" > .env | |
- name: yarn build | |
run: yarn build | |
- name: zip | |
uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r build.zip build | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: nightly-${{ steps.date.outputs.date }} | |
files: build.zip | |
prerelease: true |