Skip to content

Merge pull request #29 from moesaid/stage #20

Merge pull request #29 from moesaid/stage

Merge pull request #29 from moesaid/stage #20

on:
# workflow_dispatch
push:
branches: [main]
name: Windows
jobs:
build-windows:
name: "Build Windows for MS Store"
runs-on: windows-latest
timeout-minutes: 30
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
steps:
- uses: actions/[email protected]
- name: read yaml
id: read_action_js
uses: pietrobolcato/[email protected]
with:
config: ${{ github.workspace }}/pubspec.yaml
- name: Create Version Number
id: versions
run: |
echo "::set-output name=version::${{ steps.read_action_js.outputs['version'] }}"
- name: Setup Flutter SDK
uses: subosito/[email protected]
with:
channel: "stable"
- name: Enable desktop
run: flutter config --enable-windows-desktop
- name: Generate MSIX-compatible version
uses: ashley-taylor/[email protected]
id: msixver
with:
value: ${{steps.versions.outputs.version }}
regex: (\-\w+)|(\+\w+)
replacement: ""
- name: Create PFX certificate
id: createPfx
shell: pwsh
env:
PFX_CONTENT: ${{ secrets.PROD_WIN_CERTIFICATE }}
run: |
$pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx";
$encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT);
Set-Content $pfxPath -Value $encodedBytes -AsByteStream;
Write-Output "::set-output name=PFX_PATH::$pfxPath";
- name: Write MSIX
uses: DamianReeves/[email protected]
with:
path: pubspec.yaml
contents: |
msix_config:
display_name: FlutterPP
msix_version: ${{steps.msixver.outputs.value }}.0
logo_path: assets\windwos.png
architecture: x64
capabilities: "internetClient,removableStorage"
certificate_path: ${{ steps.createPfx.outputs.PFX_PATH }}
certificate_password: ${{ secrets.PROD_WIN_CERTIFICATE_PWD }}
store: false
install_certificate: false
write-mode: append
- name: Flutter get packages
run: flutter pub get
- name: Flutter build app
run: flutter build windows
- name: Create MSIX
run: flutter pub run msix:create
- name: Delete PFX certificate
shell: pwsh
env:
PFX_PATH: ${{ steps.createPfx.outputs.PFX_PATH }}
run: |
Remove-Item -Path $env:PFX_PATH;
- name: Upload MSIX to release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/windows/x64/Runner/release/FlutterPP.msix
asset_name: FlutterPP-windows-${{ steps.versions.outputs.version }}-MS-NS.msix
tag: ${{ steps.versions.outputs.version }}
release_name: Release ${{ steps.versions.outputs.version }}