Skip to content

Update upload-artifact action after deprecation #689

Update upload-artifact action after deprecation

Update upload-artifact action after deprecation #689

Workflow file for this run

name: "build"
on:
push:
tags:
- "v*"
branches:
- "main"
pull_request:
branches:
- "main"
# https://docs.flutter.dev/development/tools/sdk/releases?tab=linux
env:
FLUTTER_VERSION: "3.3.10"
FLUTTER_BRANCH: "stable"
jobs:
android:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: "Set version string for release"
run: echo DESTINY_VERSION=${{ github.ref_name }} >> $GITHUB_ENV
if: ${{ github.ref_type == 'tag' }}
- name: "Set version string for branch"
run: echo DESTINY_VERSION=${{ github.head_ref }} >> $GITHUB_ENV
if: ${{ github.ref_type != 'tag' }}
- name: "Setup flutter"
uses: subosito/flutter-action@v2
with:
# set fixed stable version, to avoid surprises, when flutter upgrades
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_BRANCH }}
- name: "Flutter info"
run: flutter doctor
- name: "Fetch flutter dependencies"
run: "flutter pub get"
- name: "Lint"
run: "flutter analyze --write analyze.output"
- name: "Style check"
run: "flutter format --set-exit-if-changed lib test"
- name: "Run tests"
run: "flutter test --machine --coverage | tee tests.output"
- uses: sonarsource/sonarqube-scan-action@master
if: github.ref_name == 'main' && github.event_name == 'push'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# We are building debug version APK which can be manually install, however it cannot be reused for upload to store
- name: "Build debug apk"
run: "flutter build apk lib/main_la.dart --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }} --debug"
- name: "Move apk"
run: mv ./build/app/outputs/flutter-apk/app-debug.apk destiny_android_${{ env.DESTINY_VERSION }}.apk
- name: "Copy apk"
uses: "actions/upload-artifact@v4"
with:
name: "destiny-android-${{ env.DESTINY_VERSION }}-unsigned"
path: destiny_android_${{ env.DESTINY_VERSION }}.apk
if-no-files-found: "error"
- uses: ncipollo/release-action@v1
with:
artifacts: destiny_android_${{ env.DESTINY_VERSION }}.apk
allowUpdates: true
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref_type == 'tag' }}
linux:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Set version string for release"
run: echo DESTINY_VERSION=${{ github.ref_name }} >> $GITHUB_ENV
if: ${{ github.ref_type == 'tag' }}
- name: "Set version string for branch"
run: echo DESTINY_VERSION=${{ github.head_ref }} >> $GITHUB_ENV
if: ${{ github.ref_type != 'tag' }}
- name: "Setup flutter"
uses: subosito/flutter-action@v2
with:
# set fixed stable version, to avoid surprises, when flutter upgrades
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_BRANCH }}
- run: flutter --version
- name: "Fetch flutter dependencies"
run: "flutter pub get"
- name: "Lint"
run: "flutter analyze"
- name: "Style check"
run: "flutter format --set-exit-if-changed lib test"
- name: "Run tests"
run: "flutter test --coverage"
- name: "Enable linux builds"
run: "flutter config --enable-linux-desktop"
- name: "Install linux build dependencies"
run: "sudo apt update && sudo apt install ninja-build libgtk-3-dev libgtkmm-3.0-dev libfuse2"
- name: "Build for linux"
run: "flutter build linux lib/main_la.dart --dart-define version=${{ env.DESTINY_VERSION }}"
- name: "rpath workaround"
run: |
cd build/linux/x64/release/bundle
patchelf --remove-needed libbindings.so destiny
patchelf --add-needed libbindings.so destiny
patchelf --remove-needed libwormhole_william.so destiny
patchelf --add-needed libwormhole_william.so destiny
- name: "Prepare tarball"
run: |
cp -r build/linux/x64/release/bundle "destiny_linux_${{ env.DESTINY_VERSION }}"
tar -czf destiny_linux_${{ env.DESTINY_VERSION }}.tar.gz "destiny_linux_${{ env.DESTINY_VERSION }}"
- name: "Make AppImage"
run: |
./scripts/make_appimage.sh
mv Destiny-x86_64.AppImage destiny_linux_${{ env.DESTINY_VERSION }}.AppImage
- name: "Upload zip"
uses: "actions/upload-artifact@v4"
with:
name: "destiny-linux-${{ env.DESTINY_VERSION }}-unsigned"
path: "destiny_linux_${{ env.DESTINY_VERSION }}.tar.gz"
if-no-files-found: "error"
- name: "Upload AppImage"
uses: "actions/upload-artifact@v4"
with:
name: "destiny-linux-${{ env.DESTINY_VERSION }}-appimage-unsigned"
path: "destiny_linux_${{ env.DESTINY_VERSION }}.AppImage"
if-no-files-found: "error"
- uses: ncipollo/release-action@v1
with:
artifacts: "destiny_linux_${{ env.DESTINY_VERSION }}.tar.gz,destiny_linux_${{ env.DESTINY_VERSION }}.AppImage"
allowUpdates: true
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref_type == 'tag' }}
macos:
runs-on: macos-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Set version string for release"
run: echo DESTINY_VERSION=${{ github.ref_name }} >> $GITHUB_ENV
if: ${{ github.ref_type == 'tag' }}
- name: "Set version string for branch"
run: echo DESTINY_VERSION=${{ github.head_ref }} >> $GITHUB_ENV
if: ${{ github.ref_type != 'tag' }}
- name: "Setup flutter"
uses: subosito/flutter-action@v2
with:
# set fixed stable version, to avoid surprises, when flutter upgrades
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_BRANCH }}
- run: flutter --version
- name: "Fetch flutter dependencies"
run: "flutter pub get"
- name: "Lint"
run: "flutter analyze"
- name: "Style check"
run: "flutter format --set-exit-if-changed lib test"
- name: "Run tests"
run: "flutter test --coverage"
# TODO maybe this can be avoided by some project configuration,
# but running it locally doesn't change any files either.
- name: "Enable macos desktop builds"
run: "flutter config --enable-macos-desktop"
- name: "Build mac app"
run: "flutter build macos lib/main_la.dart --debug --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }}"
- name: "Install create-dmg"
run: "brew install create-dmg"
- name: "Create DMG"
run: "create-dmg --app-drop-link 0 0 destiny_macos_debug_${{ env.DESTINY_VERSION }}.dmg build/macos/Build/Products/Debug/Destiny.app"
- name: "Copy DMG"
uses: "actions/upload-artifact@v4"
with:
name: "destiny-macos-${{ env.DESTINY_VERSION }}-unsigned"
path: "./destiny_macos_debug_${{ env.DESTINY_VERSION }}.dmg"
if-no-files-found: "error"
- uses: ncipollo/release-action@v1
with:
artifacts: "./destiny_macos_debug_${{ env.DESTINY_VERSION }}.dmg"
allowUpdates: true
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref_type == 'tag' }}
ios:
runs-on: macos-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Set version string for release"
run: echo DESTINY_VERSION=${{ github.ref_name }} >> $GITHUB_ENV
if: ${{ github.ref_type == 'tag' }}
- name: "Set version string for branch"
run: echo DESTINY_VERSION=${{ github.head_ref }} >> $GITHUB_ENV
if: ${{ github.ref_type != 'tag' }}
- name: "Setup flutter"
uses: subosito/flutter-action@v2
with:
# set fixed stable version, to avoid surprises, when flutter upgrades
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_BRANCH }}
- run: flutter --version
- name: "Fetch flutter dependencies"
run: "flutter pub get"
# TODO remove the || true when this should be enforced
# Right now it is just informational
- name: "Lint"
run: "flutter analyze || true"
- name: "Style check"
run: "flutter format --set-exit-if-changed lib test"
- name: "Run tests"
run: "flutter test --coverage"
- name: "Build ios app (only for simulator)"
run: |
export GOROOT=`go env GOROOT`
flutter build ios lib/main_la.dart --debug --simulator --no-codesign --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }}
windows:
runs-on: windows-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Set version string for release"
run: 'echo "DESTINY_VERSION=${{ github.ref_name }}" >> $env:GITHUB_ENV'
if: ${{ github.ref_type == 'tag' }}
- name: "Set version string for branch"
run: 'echo "DESTINY_VERSION=${{ github.head_ref }}" >> $env:GITHUB_ENV'
if: ${{ github.ref_type != 'tag' }}
- name: "Setup flutter"
uses: subosito/flutter-action@v2
with:
# set fixed stable version, to avoid surprises, when flutter upgrades
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_BRANCH }}
- run: flutter --version
- name: "Fetch flutter dependencies"
run: "flutter pub get"
- name: "Lint"
run: "flutter analyze"
- name: "Style check"
run: "flutter format --set-exit-if-changed lib test"
- name: "Run tests"
run: "flutter test --coverage"
- name: "Build windows"
run: "flutter build windows lib/main_la.dart --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }}"
- name: "Copy VC++ redistributables"
run: |
$vcredistpath = ((Get-ChildItem -Filter "msvcp140.dll" -Recurse "C:/Program Files/Microsoft Visual Studio/")[0] | Select -expand FullName) + "/.."
echo $vcredistpath
cp $vcredistpath/msvcp140.dll build/windows/runner/Release
cp $vcredistpath/vcruntime140.dll build/windows/runner/Release
cp $vcredistpath/vcruntime140_1.dll build/windows/runner/Release
- name: "Zip executable and libraries"
run: |
cp -r build/windows/runner/Release destiny_windows_${{ env.DESTINY_VERSION }}
7z a destiny_windows_${{ env.DESTINY_VERSION }}.zip "destiny_windows_${{ env.DESTINY_VERSION }}"
- name: "Create windows installer"
run: |
$version = ("${{ github.ref_name }}" -replace "v","") + ".0"
if ( -not ( $version -match "^\d+\.\d+\.\d+\.\d+$" ) ) {
echo "Invalid version for MSIX packaging: $version. Using 0.0.1.0 instead"
$version = "0.0.1.0"
}
echo y | flutter pub run msix:create --version $version --output-path . --build-windows false --output-name destiny_windows_${{ env.DESTINY_VERSION }}
- name: "Upload zip"
uses: "actions/upload-artifact@v4"
with:
name: "destiny-windows-${{ env.DESTINY_VERSION }}-unsigned"
path: "destiny_windows_${{ env.DESTINY_VERSION }}.zip"
if-no-files-found: "error"
- name: "Upload msix"
uses: "actions/upload-artifact@v4"
with:
name: "destiny-windows-${{ env.DESTINY_VERSION }}-unsigned-msix"
path: "destiny_windows_${{ env.DESTINY_VERSION }}.msix"
if-no-files-found: "error"
- uses: ncipollo/release-action@v1
with:
artifacts: "destiny_windows_${{ env.DESTINY_VERSION }}.zip,destiny_windows_${{ env.DESTINY_VERSION }}.msix"
allowUpdates: true
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref_type == 'tag' }}