Slide 30
Slide 30 text
© ZOZO Technologies, Inc.
30
name: Android CI on Pull Request Open
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
outputs:
distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }}
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew assembleDebug
- name: Distribute App
id: distribute_app
run: |
distribution_page_url=$(curl \
-F "token=${{secrets.DEPLOYGATE_TOKEN}}" \
-F "file=@app/build/outputs/apk/debug/app-debug.apk" \
-F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \
-F "distribution_name=$GITHUB_HEAD_REF" \
https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url)
echo "::set-output name=distribution_page_url::$distribution_page_url"
- name: Comment to Pull Request
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const comments = await github.paginate(github.issues.listComments, {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const comment of comments) {
if (comment.body.includes("https://deploygate.com/distributions/")) {
return // The URL for the distribution page has already been posted.
}
}
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}'
})