|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - test |
| 7 | + types: |
| 8 | + - closed |
| 9 | + |
| 10 | +jobs: |
| 11 | + create-release: |
| 12 | + name: Create Release |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Create short commit SHA |
| 17 | + id: create_short_sha |
| 18 | + run: echo "::set-output name=sha_short::$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8))" |
| 19 | + |
| 20 | + - name: release |
| 21 | + uses: actions/create-release@v1 |
| 22 | + id: create_release |
| 23 | + with: |
| 24 | + release_name: ${{ github.event.pull_request.title }} #pull request title |
| 25 | + body: ${{ github.event.pull_request.body }} |
| 26 | + tag_name: ${{ steps.create_short_sha.outputs.sha_short }} |
| 27 | + env: |
| 28 | + GITHUB_TOKEN: ${{ github.token }} |
| 29 | + |
| 30 | + - id: step_version |
| 31 | + run: echo "::set-output name=version::${{ steps.package_version.outputs.version }}" |
| 32 | + - id: step_upload_url |
| 33 | + run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}" |
| 34 | + outputs: |
| 35 | + version: ${{ steps.step_version.outputs.version }} |
| 36 | + upload_url: ${{ steps.step_upload_url.outputs.upload_url }} |
| 37 | + |
| 38 | + |
| 39 | + build-android: |
| 40 | + name: Build android and upload |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: create-release |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v2 |
| 46 | + - uses: subosito/flutter-action@v1.5.3 |
| 47 | + - uses: actions/setup-java@v2 |
| 48 | + with: |
| 49 | + distribution: 'zulu' |
| 50 | + java-version: '11' |
| 51 | + |
| 52 | + - name: Install dependencies |
| 53 | + run: flutter pub get |
| 54 | + |
| 55 | + - name: Build apk |
| 56 | + run: flutter build apk |
| 57 | + |
| 58 | + - name: Upload apk to release |
| 59 | + uses: actions/upload-release-asset@v1 |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ github.token }} |
| 62 | + with: |
| 63 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 64 | + asset_path: ${{ env.GITHUB_WORKSPACE }}/build/app/outputs/flutter-apk/app-release.apk |
| 65 | + asset_name: corecoder_develop_${{ needs.jobs.create-release.outputs.sha_short }}.apk |
| 66 | + asset_content_type: application/gzip |
| 67 | + build-windows: |
| 68 | + name: Build windows and upload |
| 69 | + runs-on: windows-latest |
| 70 | + needs: create-release |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v2 |
| 73 | + - uses: subosito/flutter-action@v1 |
| 74 | + with: |
| 75 | + channel: beta |
| 76 | + - name: Install dependencies |
| 77 | + run: flutter pub get |
| 78 | + - name: Enable windows |
| 79 | + run: flutter config --enable-windows-desktop |
| 80 | + - name: Build windows |
| 81 | + run: flutter build windows |
| 82 | + #TODO: upload windows i dont know windows file path help |
0 commit comments