|
| 1 | +on: |
| 2 | + # Triggers the workflow on push or pull request events but only for the main branch |
| 3 | + push: |
| 4 | + branches: [ main ] |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +# pull_request: |
| 9 | +# branches: [ main ] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + release: |
| 16 | + name: Create new releas and attach IPKs |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + needs: build |
| 21 | + steps: |
| 22 | + - name: Branch name |
| 23 | + id: branch_name |
| 24 | + run: | |
| 25 | + echo ::set-output name=IS_TAG::${{ startsWith(github.ref, 'refs/tags/') }} |
| 26 | + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} |
| 27 | + echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/*/} |
| 28 | +
|
| 29 | + - name: Download artifact |
| 30 | + env: |
| 31 | + IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }} |
| 32 | + SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }} |
| 33 | + if: "${{ env.IS_TAG == 'true' }}" |
| 34 | + uses: actions/download-artifact@v2 |
| 35 | + with: |
| 36 | + name: ${{ env.ARTIFACT_NAME }} |
| 37 | + |
| 38 | + - name: View content |
| 39 | + env: |
| 40 | + IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }} |
| 41 | + SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }} |
| 42 | + if: "${{ env.IS_TAG == 'true' }}" |
| 43 | + run: ls -R |
| 44 | + |
| 45 | + - name: Create tagged release |
| 46 | + id: create_release |
| 47 | + env: |
| 48 | + IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }} |
| 49 | + SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }} |
| 50 | + if: "${{ env.IS_TAG == 'true' }}" |
| 51 | + uses: ncipollo/release-action@v1 |
| 52 | + with: |
| 53 | + tag: ${{ env.SOURCE_TAG }} |
| 54 | + name: ${{ env.SOURCE_TAG }} |
| 55 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + prerelease: false |
| 57 | + artifacts: "./*/*.ipk" |
| 58 | + |
| 59 | + build: |
| 60 | + name: Build .ipk packages |
| 61 | + runs-on: ubuntu-latest |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout Code |
| 65 | + uses: actions/checkout@v2 |
| 66 | + |
| 67 | + - name: Get GitHub Build Number (ENV) |
| 68 | + id: get_buildno |
| 69 | + run: echo "GITHUBBUILDNUMBER=${{ github.run_number }}" >> $GITHUB_ENV |
| 70 | + continue-on-error: true |
| 71 | + |
| 72 | + - name: Get repository name |
| 73 | + run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | cut -d '/' -f2)" >> $GITHUB_ENV |
| 74 | + shell: bash |
| 75 | + |
| 76 | + - name: Make artifact name |
| 77 | + id: make_artifactname |
| 78 | + run: | |
| 79 | + ARTIFACT_NAME="${{ env.REPOSITORY_NAME }}-${{ github.run_number }}" |
| 80 | + echo "${ARTIFACT_NAME}" |
| 81 | + echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV |
| 82 | +
|
| 83 | + - uses: nttld/setup-ndk@v1 |
| 84 | + id: setup-ndk |
| 85 | + with: |
| 86 | + ndk-version: r23b |
| 87 | + add-to-path: false |
| 88 | + |
| 89 | + - name: Build .ipk |
| 90 | + env: |
| 91 | + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 92 | + run: | |
| 93 | + export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH |
| 94 | + make ipk |
| 95 | +
|
| 96 | + - name: Upload release artifacts |
| 97 | + uses: actions/upload-artifact@v2 |
| 98 | + with: |
| 99 | + name: ${{ env.ARTIFACT_NAME }} |
| 100 | + path: | |
| 101 | + ./ipk/*.ipk |
0 commit comments