Merge pull request #12 from jdk-21/jdk-21-patch-1 #4
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
version: | |
name: Create version number | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Fetch all history for all tags and branches | |
run: | | |
git config remote.origin.url https://x-access-token:${{ secrets.API_TOKEN_GITHUB }}@github.com/${{ github.repository }} | |
git fetch --prune --depth=10000 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Use GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Create version.txt with nuGetVersion | |
run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt | |
- name: Upload version.txt | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gitversion | |
path: version.txt | |
build_web: | |
name: Create Web Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: "12.x" | |
cache: gradle | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Start Web Release Build | |
run: flutter build web --release | |
- name: Upload Web Build Files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: web-release | |
path: ./build/web | |
deploy_web: | |
name: Deploy Web Build | |
needs: build_web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Web Release | |
uses: actions/download-artifact@v2 | |
with: | |
name: web-release | |
- name: Deploy to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./ | |
build_android: | |
name: Build and Release Android | |
needs: [version] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v3 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Update version in YAML | |
run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '12.x' | |
cache: gradle | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Run Pub get | |
run: flutter pub get | |
- name: Build apk | |
run: flutter build apk --release | |
- name: Build Android App Bundle | |
run: flutter build appbundle --release | |
- name: Upload app bundle | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jellyflix-apk | |
path: build/app/outputs/bundle/release/*.apk | |
build_linux: | |
name: Build Linux | |
needs: [version] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v3 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Update version in YAML | |
run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '12.x' | |
cache: gradle | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Setup build tools | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y ninja-build libgtk-3-dev clang libmpv-dev mpv libsecret-1-dev libjsoncpp-dev | |
flutter doctor | |
- name: Run Pub get | |
run: flutter pub get | |
- name: Build Linux | |
run: flutter build linux --release | |
- name: Upload Linux | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jellyflix-linux | |
path: build/linux/release/bundle.jellyflix-*.tar.gz | |
build_windows: | |
name: Build Windows | |
needs: [version] | |
runs-on: windows-latest | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v3 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: (Get-Content version.txt) -join '' | Set-Content version1.txt | |
shell: pwsh | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Update version in YAML | |
run: (Get-Content pubspec.yaml) -replace '99.99.99+99', "${{ steps.version.outputs.content }}+${{ github.run_number }}" | Set-Content pubspec.yaml | |
shell: pwsh | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '12.x' | |
cache: gradle | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Run Pub get | |
run: flutter pub get | |
- name: Build Windows | |
run: flutter build windows --release | |
- name: Upload Windows | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jellyflix-windows | |
path: build/windows/runner/Release/*.exe | |
create_release: | |
name: Create Release | |
needs: [build_android, build_linux, build_windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v3 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Download Artifacts APK | |
uses: actions/download-artifact@v2 | |
with: | |
name: jellyflix-apk | |
- name: Download Artifacts Linux | |
uses: actions/download-artifact@v2 | |
with: | |
name: jellyflix-linux | |
- name: Download Artifacts Windows | |
uses: actions/download-artifact@v2 | |
with: | |
name: jellyflix-windows | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: | | |
jellyflix-apk/*.apk | |
jellyflix-linux/*.tar.gz | |
jellyflix-windows/*.exe | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
tag: ${{ steps.version.outputs.content }} | |
commit: ${{ github.sha }} |