Skip to content

v1.0.1배포

v1.0.1배포 #75

name: create artifact
on:
workflow_dispatch:
pull_request:
branches:
- master
types:
- synchronize
- opened
jobs:
common_setup:
uses: ./.github/workflows/common-setup.yaml
secrets: inherit
upload_apk:
needs: common_setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 18
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '18'
cache: 'gradle'
- name: Download common setup files
uses: actions/download-artifact@v4
with:
name: common-setup-files
- name: Build with assembleRelease for apk
run: ./gradlew assembleRelease
- name: sign apk
id: sign_app
uses: r0adkll/[email protected]
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.RELEASE_KEYSTORE_JKS }}
alias: ${{ secrets.RELEASE_KEY_ALIAS }}
keyStorePassword: ${{ secrets.RELEASE_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.RELEASE_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
- name: upload artifact with apk
uses: actions/upload-artifact@v4
with:
name: dora-artifact.apk
path: ./app/build/outputs/apk/release
retention-days: 7
overwrite: true
upload_aab:
needs: common_setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 18
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '18'
cache: 'gradle'
- name: Download common setup files
uses: actions/download-artifact@v4
with:
name: common-setup-files
- name: Build with bundleRelease for aab
run: ./gradlew bundleRelease
- name: sign aab
id: sign_app
uses: r0adkll/[email protected]
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.RELEASE_KEYSTORE_JKS }}
alias: ${{ secrets.RELEASE_KEY_ALIAS }}
keyStorePassword: ${{ secrets.RELEASE_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.RELEASE_KEY_PASSWORD }}
- name: upload artifact with aab
uses: actions/upload-artifact@v4
with:
name: dora-artifact.aab
path: ./app/build/outputs/bundle/release
retention-days: 7
overwrite: true
post_github:
needs: [ upload_apk, upload_aab ]
runs-on: ubuntu-latest
steps:
- name: Get artifact ID for apk
id: get-artifact-id
run: |
artifact_id=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | \
jq -r '.artifacts[] | select(.name == "dora-artifact.apk") | .id')
echo "artifact_id=${artifact_id}" >> $GITHUB_ENV
- name: Get artifact ID for AAB
id: get-artifact-id-aab
run: |
artifact_id=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | \
jq -r '.artifacts[] | select(.name == "dora-artifact.aab") | .id')
echo "artifact_id_aab=${artifact_id}" >> $GITHUB_ENV
- name: Post comment with artifact link
uses: actions/[email protected]
with:
script: |
const artifact_url_apk = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts/${process.env.artifact_id}`;
const artifact_url_aab = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts/${process.env.artifact_id_aab}`;
const comment_body = `Artifact 생성 성공했 도라 :kissing_smiling_eyes:: [APK Download Link](${artifact_url_apk}), [AAB Downloads Link](${artifact_url_aab})`;
const pull_request_number = context.issue.number;
await github.rest.issues.createComment({
...context.repo,
issue_number: pull_request_number,
body: comment_body
});