Skip to content

Update deploy.yml

Update deploy.yml #2

Workflow file for this run

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 build tools
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev clang
flutter doctor
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- 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: for /f "delims=" %%i in (version.txt) do echo|set /p=%%i > 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 Windows
run: flutter build windows --release
- name: Upload Windows
uses: actions/upload-artifact@v2
with:
name: jellyflix-windows
path: build/windows/runner/Release/*.exe
build_macos:
name: Build MacOS
needs: [version]
runs-on: macos-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 MacOS
run: flutter build macos --release
- name: Upload MacOS
uses: actions/upload-artifact@v2
with:
name: jellyflix-macos
path: build/macos/Build/Products/Release/*.app
create_release:
name: Create Release
needs: [build_android, build_linux, build_windows, build_macos]
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: Download Artifacts MacOS
uses: actions/download-artifact@v2
with:
name: jellyflix-macos
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: |
jellyflix-apk/*.apk
jellyflix-linux/*.tar.gz
jellyflix-windows/*.exe
jellyflix-macos/*.app
token: ${{ secrets.API_TOKEN_GITHUB }}
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}