Skip to content

Commit

Permalink
Merge pull request #1165 from andrew-bierman/optimize-native-deployme…
Browse files Browse the repository at this point in the history
…nt-pipeline

🔥Native deployment pipeline
  • Loading branch information
andrew-bierman authored Aug 16, 2024
2 parents 9904d50 + 7b9d052 commit f79f50d
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 396 deletions.
41 changes: 41 additions & 0 deletions .github/actions/find-or-create-comment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Creates a comment to show native preview build status
# Or finds the comment if it exists
# Exposes the comment id in env in either case
name: Find or create comment
description: 'Finds the comment of build status or create one. Outputs the comment id.'

inputs:
github-token:
description: 'Github token'
required: true

runs:
using: 'composite'
steps:
- name: Find or create comment
uses: actions/github-script@v6
with:
github-token: ${{ inputs.github-token }}
script: |
const buildName = '${{ env.build-name }}';
const commentMagicPrefix = '${{ env.comment-unique-magic-prefix }}';
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find(comment => comment.body.startsWith(commentMagicPrefix));
if (existingComment) {
core.exportVariable('comment_id', existingComment.id)
} else {
const commentBody = `${commentMagicPrefix}\n🚀 ${buildName} build has started... Please wait for the results! 🕐`;
const { data: { id: commentId } } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
core.exportVariable('comment_id', commentId)
}
39 changes: 39 additions & 0 deletions .github/actions/update-native-preview-build-status/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update build status
description: 'Updates build status comment with the build results'

inputs:
github-token:
description: 'Github token'
required: true
build-outcome:
description: 'Build outcome'
required: true

runs:
using: 'composite'
steps:
- name: Update build status
uses: actions/github-script@v6
with:
github-token: ${{ inputs.github-token }}
script: |
const commentId = '${{ env.comment_id }}';
const buildOutcome = '${{ inputs.build-outcome }}';
const buildStatus = buildOutcome == 'success' ? 'completed' : 'failed';
const buildName = '${{ env.build-name }}';
const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
let commentBody = `${{ env.comment-unique-magic-prefix }}\n${buildName} build ${buildStatus}!`;
if (buildOutcome == 'success') {
commentBody += `\nYou can download the ${buildName} from the following link:\n${workflowUrl}#artifacts`;
} else {
commentBody += '\nPlease check the workflow logs for more details on the build failure.';
}
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId,
body: commentBody
});
53 changes: 0 additions & 53 deletions .github/workflows/android-build-manual.yml

This file was deleted.

138 changes: 0 additions & 138 deletions .github/workflows/android-preview-build-local.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/build.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/eas-build-manual.yml

This file was deleted.

Loading

0 comments on commit f79f50d

Please sign in to comment.