fix: add contents write permission for GitHub Release creation #4
Workflow file for this run
This file contains hidden or 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: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Decode keystore | |
| run: | | |
| mkdir -p keystore | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore/release.keystore | |
| - name: Create keystore.properties | |
| run: | | |
| cat > keystore.properties <<'EOF' | |
| storeFile=keystore/release.keystore | |
| storePassword=${{ secrets.KEYSTORE_PASSWORD }} | |
| keyAlias=${{ secrets.KEY_ALIAS }} | |
| keyPassword=${{ secrets.KEY_PASSWORD }} | |
| EOF | |
| - name: Decode google-services.json | |
| run: | | |
| echo "${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}" | base64 -d > app/google-services.json | |
| - name: Build release APK | |
| run: ./gradlew assembleRelease | |
| - name: Get version name | |
| id: version | |
| run: echo "name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Memosly ${{ steps.version.outputs.name }} | |
| files: app/build/outputs/apk/release/app-release.apk | |
| generate_release_notes: false | |
| body: | | |
| ## 安装方式 | |
| 1. 下载下方的 `app-release.apk` | |
| 2. 在 Android 设备上允许"安装未知来源应用" | |
| 3. 打开 APK 文件安装 | |
| ## Installation | |
| 1. Download `app-release.apk` below | |
| 2. Enable "Install from unknown sources" on your Android device | |
| 3. Open the APK to install |