Skip to content

Commit

Permalink
publish fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Lauer authored and Jake Lauer committed May 22, 2024
1 parent 3d45d66 commit 147df82
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ on:
required: true

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

trigger-build:
needs: setup
runs-on: ubuntu-latest
outputs:
build_workflow_run_id: ${{ steps.trigger-build.outputs.workflowId }}
build_workflow_run_id: ${{ steps.get-build-run-id.outputs.run_id }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Trigger Build Workflow
id: trigger-build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build
token: ${{ secrets.GH_PAT }}
- name: Fetch the Build Workflow Run ID
id: get-build-run-id
run: |
echo "Fetching the Build Workflow Run ID..."
BUILD_RUN_ID=$(gh run list --repo jakelauer/theseus-js --workflow=Build.yml --limit=1 | awk '{print $1}')
echo "::set-output name=run_id::$BUILD_RUN_ID"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

wait-for-build:
needs: trigger-build
Expand All @@ -36,26 +35,30 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Wait for Build to Complete
id: wait-for-build
run: |
gh run watch ${{ needs.trigger-build.outputs.build_workflow_run_id }}
run: gh run watch ${{ needs.trigger-build.outputs.build_workflow_run_id }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

trigger-test:
needs: wait-for-build
runs-on: ubuntu-latest
outputs:
test_workflow_run_id: ${{ steps.trigger-test.outputs.workflowId }}
test_workflow_run_id: ${{ steps.get-test-run-id.outputs.run_id }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Trigger Test Workflow
id: trigger-test
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Test
token: ${{ secrets.GH_PAT }}
- name: Fetch the Test Workflow Run ID
id: get-test-run-id
run: |
echo "Fetching the Test Workflow Run ID..."
TEST_RUN_ID=$(gh run list --repo jakelauer/theseus-js --workflow=Test.yml --limit=1 | awk '{print $1}')
echo "::set-output name=run_id::$TEST_RUN_ID"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

wait-for-test:
needs: trigger-test
Expand All @@ -64,9 +67,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Wait for Test to Complete
id: wait-for-test
run: |
gh run watch ${{ needs.trigger-test.outputs.test_workflow_run_id }}
run: gh run watch ${{ needs.trigger-test.outputs.test_workflow_run_id }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -76,21 +77,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Update Version
run: pnpm update-version --type ${{ github.event.inputs.publish_type }} --commit true

- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
git push origin main
run: git push origin main
- name: Publish package
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Expand Down

0 comments on commit 147df82

Please sign in to comment.