Skip to content

chore(workflow): update permissions for GitHub Actions #148

chore(workflow): update permissions for GitHub Actions

chore(workflow): update permissions for GitHub Actions #148

Workflow file for this run

name: Build Orion
on:
push:
workflow_call:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
repository-projects: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: subosito/flutter-action@v2
with:
channel: "stable" # or: 'beta', 'dev', 'master' (or 'main')
flutter-version: 3.24.4
- run: sudo apt-get update && sudo apt-get install -y gtk+-3.0
- run: flutter pub global activate flutterpi_tool
- run: flutter build linux
- name: Get Version
id: get_version
run: |
VERSION=$(yq '.version' pubspec.yaml)
# Strip build metadata if it exists
VERSION=$(echo $VERSION | sed 's/+.*//')
echo "result=$VERSION" >> $GITHUB_OUTPUT
- name: Update Version with Commit Hash
run: |
VERSION=$(yq '.version' pubspec.yaml)
COMMIT_HASH=${GITHUB_SHA::7}
NEW_VERSION=${VERSION/+SELFCOMPILED/+${COMMIT_HASH}}
yq -i ".version = \"$NEW_VERSION\"" pubspec.yaml
echo "Updated version to $NEW_VERSION"
- name: Run pubspec_extract
run: flutter pub run pubspec_extract
- name: Build, Copy, and Compress armv7
run: |
BUILD_NAME=orion_armv7
flutterpi_tool build --release
mv build/flutter_assets $BUILD_NAME
( cd $BUILD_NAME && tar -czvf $BUILD_NAME.tar.gz * )
cp $BUILD_NAME/$BUILD_NAME.tar.gz $BUILD_NAME.tar.gz
- uses: actions/[email protected]
with:
name: orion_armv7
path: orion_armv7/*
- name: Build, Copy, and Compress aarch64
run: |
BUILD_NAME=orion_aarch64
flutterpi_tool build --arch=arm64 --release
mv build/flutter_assets $BUILD_NAME
( cd $BUILD_NAME && tar -czvf $BUILD_NAME.tar.gz * )
cp $BUILD_NAME/$BUILD_NAME.tar.gz $BUILD_NAME.tar.gz
- uses: actions/[email protected]
with:
name: orion_aarch64
path: orion_aarch64/*
- name: Build, Copy, and Compress x64
run: |
BUILD_NAME=orion_x64
flutterpi_tool build --arch=x64 --release
mv build/flutter_assets $BUILD_NAME
( cd $BUILD_NAME && tar -czvf $BUILD_NAME.tar.gz * )
cp $BUILD_NAME/$BUILD_NAME.tar.gz $BUILD_NAME.tar.gz
- uses: actions/[email protected]
with:
name: orion_x64
path: orion_x64/*
- uses: ncipollo/[email protected]
if: github.ref == 'refs/heads/main'
with:
artifacts: orion*.tar.gz
tag: v${{ steps.get_version.outputs.result }}
skipIfReleaseExists: true
generateReleaseNotes: true
commit: ${{github.sha}}
- uses: ncipollo/[email protected]
if: github.ref != 'refs/heads/main'
with:
artifacts: orion*.tar.gz
tag: BRANCH_${{github.ref_name}}
skipIfReleaseExists: false
allowUpdates: true
prerelease: true
generateReleaseNotes: true
commit: ${{github.sha}}