Skip to content

Commit

Permalink
[actions] upload pr artifacts to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Feb 15, 2025
1 parent 3efeff6 commit d3ab6a6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 21 deletions.
60 changes: 49 additions & 11 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release

on:
pull_request: { types: [ opened, synchronize ] }
pull_request: { types: [opened, synchronize] }

jobs:
build:
Expand All @@ -19,17 +19,55 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-artifacts
- name: Pull request artifacts
uses: gavv/pull-request-artifacts@v2

- name: Upload to S3
uses: capcom6/upload-s3-action@d4d6efb2abf15cb029824e58ccd18d6b215fae11
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
with:
# Commit hash that triggered PR
commit: ${{ github.event.pull_request.head.sha }}
# Token for current repo (used to post PR comment)
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifacts-branch: artifacts
artifacts: |
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.AWS_BUCKET }}
endpoint: ${{ secrets.AWS_ENDPOINT }}
source_files: |
./apk/release/app-release.apk
./bundle/release/app-release.aab
./bundle/release/app-release.aab
destination_dir: apk/${{ github.event.pull_request.head.sha }}

- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Pull request artifacts

- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
## 🤖 Pull request artifacts
| file | commit |
| ---- | ------ |
| [`app-release.apk`](https://s3.sms-gate.app/apk/${{ github.event.pull_request.head.sha }}/app-release.apk) | ${{ github.event.pull_request.head.sha }} |
| [`app-release.aab`](https://s3.sms-gate.app/apk/${{ github.event.pull_request.head.sha }}/app-release.aab) | ${{ github.event.pull_request.head.sha }} |
- name: Update comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
## 🤖 Pull request artifacts
| file | commit |
| ---- | ------ |
| [`app-release.apk`](https://s3.sms-gate.app/apk/${{ github.event.pull_request.head.sha }}/app-release.apk) | ${{ github.event.pull_request.head.sha }} |
| [`app-release.aab`](https://s3.sms-gate.app/apk/${{ github.event.pull_request.head.sha }}/app-release.aab) | ${{ github.event.pull_request.head.sha }} |
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig

# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,android,androidstudio,intellij,linux,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,android,androidstudio,intellij,linux,windows
# Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,macos,linux,intellij,androidstudio,android,dotenv
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,macos,linux,intellij,androidstudio,android,dotenv

### Android ###
# Gradle files
Expand Down Expand Up @@ -44,6 +43,9 @@ gen-external-apklibs
# Replacement of .externalNativeBuild directories introduced
# with Android Studio 3.5.

### dotenv ###
.env

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
Expand Down Expand Up @@ -224,12 +226,6 @@ Temporary Items
.history
.ionide

# Support for Project snippet scope
.vscode/*.code-snippets

# Ignore code-workspaces
*.code-workspace

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Expand Down Expand Up @@ -369,7 +365,7 @@ hs_err_pid*

!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,android,androidstudio,intellij,linux,windows
# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,macos,linux,intellij,androidstudio,android,dotenv

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

0 comments on commit d3ab6a6

Please sign in to comment.