|
| 1 | +name: "PR Build" |
| 2 | +run-name: "PR Build ${{ inputs.DEPLOY_TARGET }} triggered by ${{ github.EVENT_NAME }} (@${{ github.ACTOR }})" |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + types: [opened, reopened] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-for-pr: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + env: |
| 12 | + REPO_SELF: ${{ vars.REPO_SELF }} |
| 13 | + APP_PATH: "applications_user/subbrute" |
| 14 | + RELATIVE_PATH: "applications/external/subbrute" |
| 15 | + PREV_TAG: "" |
| 16 | + APP_NAME: "" |
| 17 | + ZIP_NAME: "" |
| 18 | + ZIP_TAG: "" |
| 19 | + TGZ_NAME: "" |
| 20 | + TGZ_TAG: "" |
| 21 | + SHA: "" |
| 22 | + FW_VERSION: "" |
| 23 | + RELEASE_VERSION: "" |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + firmware: [unlshd, official] |
| 28 | + include: |
| 29 | + - firmware: unlshd |
| 30 | + url: ${{ vars.REPO_UNLEASHED }} |
| 31 | + version: ${{ vars.FIRMWARE_VERSION }} |
| 32 | + src-included: 0 |
| 33 | + - firmware: official |
| 34 | + url: ${{ vars.REPO_OFFICIAL }} |
| 35 | + version: official |
| 36 | + src-included: 0 |
| 37 | + steps: |
| 38 | + - name: Copy Firmware Files |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + repository: ${{ matrix.url }} |
| 42 | + clean: true |
| 43 | + submodules: true |
| 44 | + ref: dev |
| 45 | + |
| 46 | + - name: Copy Repo Files |
| 47 | + if: ${{ matrix.src-included == 0 }} |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + repository: ${{ vars.REPO_SELF }} |
| 51 | + clean: true |
| 52 | + submodules: true |
| 53 | + path: ${{ env.APP_PATH }} |
| 54 | + |
| 55 | + - name: Remove other apps |
| 56 | + shell: pwsh |
| 57 | + # rm to remove problem FAP which includes non-existent files |
| 58 | + run: | |
| 59 | + Remove-Item -Force -Recurse ./applications/debug -ErrorAction SilentlyContinue |
| 60 | + Remove-Item -Force -Recurse ./applications/examples -ErrorAction SilentlyContinue |
| 61 | + Remove-Item -Force -Recurse ${{ env.RELATIVE_PATH }} -ErrorAction SilentlyContinue |
| 62 | +
|
| 63 | + - name: Get SHA of our application and release version |
| 64 | + shell: pwsh |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.FLIPPER_TOKEN }} |
| 67 | + INPUT_VERSION: ${{ inputs.version }} |
| 68 | + run: | |
| 69 | + Write-Output "::notice title=${{ matrix.firmware }} Input Version Number::v${{ inputs.version }}" |
| 70 | + $fwInfo = ((gh release view --json tagName,url -R ${{ matrix.url }}) | ConvertFrom-Json) |
| 71 | + cd '${{ env.APP_PATH }}' |
| 72 | + $sha = (git rev-parse --verify HEAD) |
| 73 | + |
| 74 | + $releaseVersion = '' |
| 75 | + $latestTag = ((gh release view --json tagName,url -R ${{ vars.REPO_SELF }}) | ConvertFrom-Json ).tagName |
| 76 | +
|
| 77 | + if ( [string]::IsNullOrWhitespace($env:INPUT_VERSION) ) { |
| 78 | + Write-Output "::notice title=${{ matrix.firmware }} Latest tag::$latestTag" |
| 79 | + |
| 80 | + $lastIndex = $latestTag.LastIndexOf('.') |
| 81 | + |
| 82 | + $minorValue = $latestTag.Substring($latestTag.LastIndexOf('.') + 1) |
| 83 | + $minorValue = [Convert]::ToInt32($minorValue) + 1 |
| 84 | + $newTag = $latestTag.Substring(0, $lastIndex) |
| 85 | + |
| 86 | + $releaseVersion = ('{0}.{1}' -f $newTag, $minorValue) |
| 87 | + } else { |
| 88 | + $releaseVersion = "$env:INPUT_VERSION" |
| 89 | + } |
| 90 | + |
| 91 | + if ( $releaseVersion.StartsWith('v') ) { |
| 92 | + $releaseVersion = $releaseVersion.Substring(1) |
| 93 | + } |
| 94 | + |
| 95 | + Write-Output "::notice title=${{ matrix.firmware }} PREV_TAG::$latestTag" |
| 96 | + Write-Output "::notice title=${{ matrix.firmware }} RELEASE_VERSION::$releaseVersion" |
| 97 | + Write-Output "::notice title=${{ matrix.firmware }} SHA::$sha" |
| 98 | + Write-Output ('::notice title=${{ matrix.firmware }} FW_VERSION::{0}' -f $fwInfo.tagName) |
| 99 | + |
| 100 | + Write-Output ('RELEASE_VERSION={0}' -f $releaseVersion) >> $env:GITHUB_ENV |
| 101 | + Write-Output ('SHA={0}' -f $sha) >> $env:GITHUB_ENV |
| 102 | + Write-Output ('FW_VERSION={0}' -f $fwInfo.tagName) >> $env:GITHUB_ENV |
| 103 | + Write-Output ('PREV_TAG={0}' -f $latestTag) >> $env:GITHUB_ENV |
| 104 | +
|
| 105 | + - name: Build Firmware |
| 106 | + shell: bash |
| 107 | + if: ${{ success() }} |
| 108 | + env: |
| 109 | + FBT_NO_SYNC: 0 |
| 110 | + DIST_SUFFIX: ${{ matrix.version }} |
| 111 | + WORKFLOW_BRANCH_OR_TAG: release-cfw |
| 112 | + run: | |
| 113 | + ./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0 |
| 114 | +
|
| 115 | + - name: Build FAPs |
| 116 | + shell: bash |
| 117 | + if: ${{ success() }} |
| 118 | + env: |
| 119 | + FBT_NO_SYNC: 0 |
| 120 | + DIST_SUFFIX: ${{ matrix.version }} |
| 121 | + WORKFLOW_BRANCH_OR_TAG: release-cfw |
| 122 | + # rm to remove problem FAP which includes non-existent files |
| 123 | + run: | |
| 124 | + ./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0 fap_dist |
| 125 | +
|
| 126 | +#EOF |
0 commit comments