Release #16
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
flag: | |
description: "Publish to Microsoft Store" | |
required: true | |
default: false | |
type: boolean | |
tag1: | |
description: "Is beta?" | |
required: true | |
default: "v" | |
type: choice | |
options: | |
- beta | |
- v | |
tag2: | |
description: "Version (e.g 2.0.0.6):" | |
required: true | |
type: string | |
jobs: | |
# Reuse the build job from build.yml | |
build: | |
name: Build | |
uses: ./.github/workflows/build.yml | |
with: | |
create_package: true | |
secrets: | |
pfx_base64_encoded: ${{ secrets.PFX_BASE64_ENCODED }} | |
release: | |
name: Create .msixbundle | |
needs: build | |
runs-on: windows-latest | |
env: | |
SigningKey_Path: SigningKey.pfx | |
Artifacts_Path: .artifacts | |
steps: | |
- name: Download .msix from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: msix-* | |
merge-multiple: true | |
path: ${{ env.Artifacts_Path }} | |
- name: Get Package Information | |
id: get_package_info | |
run: | | |
# Get the name of the .msix file | |
$file = Get-Item -Path "${{ env.Artifacts_Path }}\*.msix" | |
if ($file -is [array]) { | |
$file = $file[0] | |
} | |
# Extract the package name with version number | |
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.FullName) | |
$bundleFileName = $fileName -replace '^(.*?Natsurainko\.FluentLauncher)_(\d+\.\d+\.\d+\.\d+)(_x64|_arm64)$', '$1_$2.msixbundle' | |
$version = $fileName -replace '^(.*?Natsurainko\.FluentLauncher)_(\d+\.\d+\.\d+\.\d+)(_x64|_arm64)$', '$2' | |
echo "::set-output name=bundleFileName::$bundleFileName" | |
echo "::set-output name=version::$version" | |
- name: Create .msixbundle | |
run: | | |
# Get makeappx.exe | |
$makeappx = Get-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\makeappx.exe" | |
if ($makeappx -is [array]) { | |
$makeappx = $makeappx[0] | |
} | |
# Create the .msixbundle using makeappx.exe | |
& $makeappx.FullName bundle /d "${{ env.Artifacts_Path }}" /p "${{ steps.get_package_info.outputs.bundleFileName }}" /bv "${{ steps.get_package_info.outputs.version }}" | |
# Decode the base 64 encoded pfx and sign the package | |
- name: Sign .msixbundle | |
run: | | |
# Get signtool.exe | |
$signtool = Get-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | |
if ($signtool -is [array]) { | |
$signtool = $signtool[0] | |
} | |
# Sign .msixbundle | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.PFX_BASE64_ENCODED }}") | |
[IO.File]::WriteAllBytes("${{ env.SigningKey_Path }}", $pfx_cert_byte) | |
& $signtool sign /f "${{ env.SigningKey_Path }}" /fd SHA256 /td SHA256 "${{ steps.get_package_info.outputs.bundleFileName }}" | |
rm "${{ env.SigningKey_Path }}" | |
- name: Upload .msixbundle to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: .msixbundle | |
path: ${{ steps.get_package_info.outputs.bundleFileName }} | |
Create-Tag: | |
runs-on: ubuntu-latest | |
name: Create tag | |
needs: build | |
if: ${{inputs.flag}} | |
outputs: | |
tag: "refs/tags/${{inputs.tag1}}${{inputs.tag2}}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Config git user | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub-actions[bot]" | |
- name: Create tag | |
run: | | |
git tag -a ${{inputs.tag1}}${{inputs.tag2}} -m "${{inputs.tag1}}${{inputs.tag2}}" | |
git push origin ${{inputs.tag1}}${{inputs.tag2}} | |
Pre-Publish: | |
runs-on: ubuntu-latest | |
name: Pre-Publish | |
needs: [build, release, Create-Tag] | |
if: ${{ (contains(github.ref,'refs/tags/beta')||(inputs.flag&&contains(needs.Create-Tag.outputs.tag,'beta'))||(inputs.flag&&contains(needs.Create-Tag.outputs.tag,'v')))&&!failure() }} | |
env: | |
Artifacts_Path: .artifacts | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check tag | |
id: CheckTag | |
run: | | |
if [ "${{inputs.flag}}" ]; then | |
echo "tag=${{needs.Create-Tag.outputs.tag}}" >> "$GITHUB_OUTPUT" | |
echo exit 0 | |
else | |
echo "tag=${{github.ref}}" >> "$GITHUB_OUTPUT" | |
echo exit 0 | |
fi | |
- name: Download .msixupload from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: msixupload-* | |
merge-multiple: true | |
path: "${{ github.workspace }}/${{env.Artifacts_Path}}" | |
- name: Delete arm Pkg | |
run: find "${{ github.workspace }}/${{env.Artifacts_Path}}" -name '*arm*' -exec rm {} \; | |
- name: Pre-Publish MSStore | |
uses: trympet/microsoft-store-flight-action@v1 | |
with: | |
tenant-id: ${{ secrets.PARTNER_CENTER_TENANT_ID }} | |
client-id: ${{ secrets.PARTNER_CENTER_CLIENT_ID }} | |
client-secret: ${{ secrets.PARTNER_CENTER_CLIENT_SECRET }} | |
app-id: ${{ secrets.PARTNER_CENTER_APP_ID }} | |
flight-id: ${{ secrets.PARTNER_CENTER_BETA_APP_ID }} | |
package-path: "${{ github.workspace }}/${{env.Artifacts_Path}}/" | |
delete-pending: true | |
delete-packages: true | |
skip-polling: true | |
packages-keep: 9 | |
- name: Download .msixbundle from artifacts | |
if: ${{ !contains(needs.Create-Tag.outputs.tag,'v') }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: .msixbundle | |
path: "${{ github.workspace }}/${{env.Artifacts_Path}}" | |
- name: Create Pre-Release | |
if: ${{ !contains(needs.Create-Tag.outputs.tag,'v') }} | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "${{ github.workspace }}/${{env.Artifacts_Path}}/*.msixbundle" | |
prerelease: true | |
allowUpdates: true | |
generateReleaseNotes: true | |
tag: ${{steps.CheckTag.outputs.tag}} | |
Publish: | |
runs-on: ubuntu-latest | |
name: Publish | |
needs: [build, release, Create-Tag] | |
if: ${{ (contains(github.ref,'v2')||(inputs.flag&&contains(needs.Create-Tag.outputs.tag,'v2')))&&!failure() }} | |
env: | |
Artifacts_Path: .artifacts | |
steps: | |
- name: CheckOut | |
uses: actions/checkout@v3 | |
- name: CheckTag | |
id: CheckTag | |
run: | | |
if [ "${{inputs.flag}}" ]; then | |
echo "tag=${{needs.Create-Tag.outputs.tag}}" >> "$GITHUB_OUTPUT" | |
echo exit 0 | |
else | |
echo "tag=${{github.ref}}" >> "$GITHUB_OUTPUT" | |
echo exit 0 | |
fi | |
- name: Download .msixupload from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: msixupload-* | |
merge-multiple: true | |
path: "${{ github.workspace }}/${{env.Artifacts_Path}}" | |
- name: Delete arm Pkg | |
run: find "${{ github.workspace }}/${{env.Artifacts_Path}}" -name '*arm*' -exec rm {} \; | |
- name: Publish MSStore | |
uses: isaacrlevin/[email protected] | |
with: | |
tenant-id: ${{ secrets.PARTNER_CENTER_TENANT_ID }} | |
client-id: ${{ secrets.PARTNER_CENTER_CLIENT_ID }} | |
client-secret: ${{ secrets.PARTNER_CENTER_CLIENT_SECRET }} | |
app-id: ${{ secrets.PARTNER_CENTER_APP_ID }} | |
package-path: "${{ github.workspace }}/${{env.Artifacts_Path}}/" | |
delete-pending: true | |
delete-packages: true | |
skip-polling: true | |
packages-keep: 9 | |
- name: Download .msixbundle from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: .msixbundle | |
path: "${{ github.workspace }}/${{env.Artifacts_Path}}" | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "${{ github.workspace }}/${{env.Artifacts_Path}}/*.msixbundle" | |
allowUpdates: true | |
generateReleaseNotes: true | |
tag: ${{steps.CheckTag.outputs.tag}} |