mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-18 17:25:13 +00:00
142 lines
4.8 KiB
YAML
142 lines
4.8 KiB
YAML
|
# This is a basic workflow to help you get started with Actions
|
||
|
|
||
|
name: nightly-release
|
||
|
|
||
|
# Controls when the workflow will run
|
||
|
on:
|
||
|
# Triggers the workflow on push or pull request events but only for the main branch
|
||
|
schedule:
|
||
|
# Runs "at minute 55 past every hour" (see https://crontab.guru)
|
||
|
- cron: '0 0 * * *'
|
||
|
|
||
|
# Allows you to run this workflow manually from the Actions tab
|
||
|
workflow_dispatch:
|
||
|
|
||
|
env:
|
||
|
NODE_VERSION: 16
|
||
|
|
||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||
|
jobs:
|
||
|
# This workflow contains a single job called "build"
|
||
|
build:
|
||
|
name: Build web assets
|
||
|
runs-on: ubuntu-latest
|
||
|
needs: check_date
|
||
|
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
||
|
steps:
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
- name: Set up Node.js ${{ env.NODE_VERSION }}
|
||
|
uses: actions/setup-node@v2
|
||
|
with:
|
||
|
node-version: ${{ env.NODE_VERSION }}
|
||
|
- name: Install dependencies
|
||
|
run: npm i; cd NUXT; npm i
|
||
|
- name: Set App Version
|
||
|
working-directory: NUXT
|
||
|
run: sed -i 's/dev-local/${{ github.sha }}/' nuxt.config.js
|
||
|
- name: Build web assets
|
||
|
working-directory: NUXT
|
||
|
run: npm run generate
|
||
|
- name: Upload artifacts
|
||
|
uses: actions/upload-artifact@v2
|
||
|
with:
|
||
|
name: dist
|
||
|
path: dist
|
||
|
android:
|
||
|
name: Build Android platform
|
||
|
runs-on: ubuntu-latest
|
||
|
needs: [build]
|
||
|
steps:
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
- name: Download artifacts
|
||
|
uses: actions/download-artifact@v2
|
||
|
with:
|
||
|
name: dist
|
||
|
path: dist
|
||
|
- name: Set up Node.js ${{ env.NODE_VERSION }}
|
||
|
uses: actions/setup-node@v2
|
||
|
with:
|
||
|
node-version: ${{ env.NODE_VERSION }}
|
||
|
- name: Install dependencies
|
||
|
run: npm i
|
||
|
- name: Set up JDK 11
|
||
|
uses: actions/setup-java@v1
|
||
|
with:
|
||
|
java-version: 11
|
||
|
- name: Copy web assets to native platform
|
||
|
run: npx cap copy android
|
||
|
- name: Update native platform
|
||
|
run: npx cap update android
|
||
|
- name: Build with Gradle
|
||
|
working-directory: android
|
||
|
run: chmod +x gradlew; ./gradlew clean assembleRelease -x test -Pandroid.injected.signing.store.file=/home/runner/work/VueTube/VueTube/android/key.jks -Pandroid.injected.signing.store.password=${{ secrets.ANDROID_STORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.ANDROID_KEY_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.ANDROID_KEY_PASSWORD }}
|
||
|
- name: Upload artifacts
|
||
|
uses: actions/upload-artifact@v2
|
||
|
with:
|
||
|
name: android
|
||
|
path: android/app/build/outputs/apk/release/app-release.apk
|
||
|
|
||
|
ios:
|
||
|
name: Build iOS platform
|
||
|
runs-on: macos-latest
|
||
|
needs: [build]
|
||
|
steps:
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
- name: Download artifacts
|
||
|
uses: actions/download-artifact@v2
|
||
|
with:
|
||
|
name: dist
|
||
|
path: dist
|
||
|
- name: Set up Node.js ${{ env.NODE_VERSION }}
|
||
|
uses: actions/setup-node@v2
|
||
|
with:
|
||
|
node-version: ${{ env.NODE_VERSION }}
|
||
|
- name: Install dependencies
|
||
|
run: npm i
|
||
|
- name: Copy web assets to native platform
|
||
|
run: npx cap copy ios
|
||
|
- name: Update native platform
|
||
|
run: npx cap update ios
|
||
|
- name: Add empty `GoogleService-Info.plist`
|
||
|
run: echo "$GOOGLE_SERVICE_INFO_PLIST" > ios/App/App/GoogleService-Info.plist
|
||
|
env:
|
||
|
GOOGLE_SERVICE_INFO_PLIST: ${{secrets.GOOGLE_SERVICE_INFO_PLIST}}
|
||
|
- name: Build and archive with xcodebuild
|
||
|
working-directory: ios
|
||
|
run: xcodebuild
|
||
|
-workspace App/App.xcworkspace
|
||
|
-scheme App
|
||
|
-archivePath App/build/App.xarchive
|
||
|
clean build archive
|
||
|
CODE_SIGN_IDENTITY=""
|
||
|
CODE_SIGNING_REQUIRED=NO
|
||
|
CODE_SIGNING_ALLOWED="NO"
|
||
|
CODE_SIGN_ENTITLEMENTS=""
|
||
|
- name: Make IPA
|
||
|
run: mkdir Payload && mv ~/Library/Developer/Xcode/DerivedData/App-*/Build/Products/Debug-iphoneos/App.app Payload && zip -r Payload.zip Payload && mv Payload.zip VueTube.ipa
|
||
|
|
||
|
- name: Upload artifacts
|
||
|
uses: actions/upload-artifact@v2
|
||
|
with:
|
||
|
name: iOS
|
||
|
path: VueTube.ipa
|
||
|
|
||
|
check_date:
|
||
|
runs-on: ubuntu-latest
|
||
|
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' }}
|
||
|
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
|