|
4 | 4 | tags: |
5 | 5 | - '*' |
6 | 6 | workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + DIST_ARCHIVE_PREFIX_NAME: ${{ github.event.repository.name }} |
| 10 | + SOURCE_ARCHIVE_NAME: ${{ github.event.repository.name }} |
| 11 | + |
7 | 12 | jobs: |
8 | 13 | # lint-and-test: |
9 | 14 | # runs-on: ubuntu-latest |
|
22 | 27 | # - name: Install dependencies |
23 | 28 | # run: | |
24 | 29 | # yarn |
| 30 | + |
25 | 31 | build-android-apk: |
26 | 32 | name: Build Android APK |
27 | 33 | if: startsWith(github.ref, 'refs/tags/') |
|
33 | 39 | steps: |
34 | 40 | - name: Checkout |
35 | 41 | uses: actions/checkout@v2 |
| 42 | + - name: Get the version |
| 43 | + id: get_version |
| 44 | + run: | |
| 45 | + echo ::set-output name=PACKAGE_VERSION_NAME::$(node -p "require('./package.json').version") |
| 46 | + echo ::set-output name=COMMIT_ID::$(echo ${{ github.sha }} | cut -c1-7) |
| 47 | + - name: Set name |
| 48 | + id: set_name |
| 49 | + run: | |
| 50 | + echo ::set-output name=APK_NAME::$(echo "${{ env.DIST_ARCHIVE_PREFIX_NAME }}-${{ steps.get_version.outputs.PACKAGE_VERSION_NAME }}-${{ steps.get_version.outputs.COMMIT_ID }}.apk") |
| 51 | + echo ::set-output name=SOURCE_ZIP_NAME::$(echo "${{ env.SOURCE_ARCHIVE_NAME }}-${{ steps.get_version.outputs.PACKAGE_VERSION_NAME }}-${{ steps.get_version.outputs.COMMIT_ID }}.zip") |
| 52 | + - name: Archive source code |
| 53 | + uses: papeloto/action-zip@v1 |
| 54 | + with: |
| 55 | + files: | |
| 56 | + ./ |
| 57 | + recursive: false |
| 58 | + dest: ${{ steps.set_name.outputs.SOURCE_ZIP_NAME }} |
36 | 59 | - name: Use Node.js |
37 | 60 | uses: actions/setup-node@v2 |
38 | 61 | with: |
|
50 | 73 | - name: Build android apk |
51 | 74 | run: | |
52 | 75 | cd android && ./gradlew assembleRelease |
53 | | - - name: Get the version |
54 | | - id: get_version |
55 | | - run: | |
56 | | - echo ::set-output name=PACKAGE_VERSION_NAME::$(node -p "require('./package.json').version") |
57 | | - echo ::set-output name=COMMIT_ID::$(echo ${{ github.sha }} | cut -c1-7) |
58 | | - - name: Set apk name |
59 | | - id: set_apk_name |
60 | | - run: | |
61 | | - echo ::set-output name=APK_NAME::$(echo "v2hub-${{ steps.get_version.outputs.PACKAGE_VERSION_NAME }}-${{ steps.get_version.outputs.COMMIT_ID }}.apk") |
62 | 76 | - name: Move release apk to target directory |
63 | | - run: cp android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/${{ steps.set_apk_name.outputs.APK_NAME }} |
| 77 | + run: cp android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/${{ steps.set_name.outputs.APK_NAME }} |
64 | 78 | - name: Build changelog |
65 | 79 | id: build_changelog |
66 | 80 | |
|
74 | 88 | with: |
75 | 89 | body: ${{steps.build_changelog.outputs.changelog}} |
76 | 90 | files: | |
77 | | - android/app/build/outputs/apk/release/${{ steps.set_apk_name.outputs.APK_NAME }} |
| 91 | + android/app/build/outputs/apk/release/${{ steps.set_name.outputs.APK_NAME }} |
| 92 | + ${{ steps.set_name.outputs.SOURCE_ZIP_NAME }} |
78 | 93 | env: |
79 | 94 | GITHUB_TOKEN: ${{ secrets.github_token }} |
80 | 95 |
|
|
0 commit comments