Skip to content

Commit

Permalink
feat: runway
Browse files Browse the repository at this point in the history
  • Loading branch information
itsyoboieltr committed Jan 10, 2025
1 parent 5778b4a commit 2ffb616
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
name: Wait for CircleCI workflow status
uses: ./.github/workflows/wait-for-circleci-workflow-status.yml

runway:
name: Runway
needs:
- wait-for-circleci-workflow-status
uses: ./.github/workflows/runway.yml

publish-prerelease:
name: Publish prerelease
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -101,6 +107,7 @@ jobs:
- validate-lavamoat-policy-webapp
- run-tests
- wait-for-circleci-workflow-status
- runway
outputs:
PASSED: ${{ steps.set-output.outputs.PASSED }}
steps:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/runway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Runway

on:
workflow_call:

jobs:
runway:
name: Runway
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get build version
id: get-build-version
run: |
build_version=$(jq -r '.version' package.json)
echo 'BUILD_VERSION='"$build_version" >> "$GITHUB_OUTPUT"
echo "Build version is '${build_version}'"
- name: Get CircleCI job details
id: get-circleci-job-details
env:
OWNER: ${{ github.repository_owner }}
REPOSITORY: ${{ github.event.repository.name }}
# For a `pull_request` event, the branch is `github.head_ref``.
# For a `push` event, the branch is `github.ref_name`.
BRANCH: ${{ github.head_ref || github.ref_name }}
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
# For a `push` event, the head commit hash is `github.sha`.
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq -r ".items | map(select(.vcs.revision == \"${HEAD_COMMIT_HASH}\" )) | first | .id")
workflow_id=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].id")
job_details=$(curl --silent "https://circleci.com/api/v2/workflow/$workflow_id/job" | jq -r '.items[] | select(.name == "job-publish-prerelease")')
job_id=$(echo "$job_details" | jq -r '.id')
echo 'CIRCLE_WORKFLOW_JOB_ID='"$job_id" >> "$GITHUB_OUTPUT"
echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', job ID '${job_id}'"
- name: Download builds from CircleCI
env:
BUILD_VERSION: ${{ steps.get-build-version.outputs.BUILD_VERSION }}
CIRCLE_WORKFLOW_JOB_ID: ${{ steps.get-circleci-job-details.outputs.CIRCLE_WORKFLOW_JOB_ID }}
run: |
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/builds/metamask-chrome-${BUILD_VERSION}.zip" > "metamask-chrome-${BUILD_VERSION}.zip"
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/builds-mv2/metamask-firefox-${BUILD_VERSION}.zip" > "metamask-firefox-${BUILD_VERSION}.zip"
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/builds-flask/metamask-flask-chrome-${BUILD_VERSION}-flask.0.zip" > "metamask-flask-chrome-${BUILD_VERSION}-flask.0.zip"
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/builds-flask-mv2/metamask-flask-firefox-${BUILD_VERSION}-flask.0.zip" > "metamask-flask-firefox-${BUILD_VERSION}-flask.0.zip"
- uses: actions/upload-artifact@v4
with:
name: metamask-chrome-${{ steps.get-build-version.outputs.BUILD_VERSION }}
path: metamask-chrome-${{ steps.get-build-version.outputs.BUILD_VERSION }}.zip

- uses: actions/upload-artifact@v4
with:
name: metamask-firefox-${{ steps.get-build-version.outputs.BUILD_VERSION }}
path: metamask-firefox-${{ steps.get-build-version.outputs.BUILD_VERSION }}.zip

- uses: actions/upload-artifact@v4
with:
name: metamask-flask-chrome-${{ steps.get-build-version.outputs.BUILD_VERSION }}-flask.0
path: metamask-flask-chrome-${{ steps.get-build-version.outputs.BUILD_VERSION }}-flask.0.zip

- uses: actions/upload-artifact@v4
with:
name: metamask-flask-firefox-${{ steps.get-build-version.outputs.BUILD_VERSION }}-flask.0
path: metamask-flask-firefox-${{ steps.get-build-version.outputs.BUILD_VERSION }}-flask.0.zip

0 comments on commit 2ffb616

Please sign in to comment.