chore: Publish preview release + deploy staging every 3 hours (#7341)

* wip

* Wrap up

* Update .github/workflows/trigger-staging-deployment.yml

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* enable schedule

---------

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
Oli Juhl
2024-05-16 12:36:30 +02:00
committed by GitHub
parent 845eda4643
commit 2e42e053d4
3 changed files with 85 additions and 7 deletions

View File

@@ -19,13 +19,14 @@ on:
- "docs/**"
- "www/**"
- ".github/**"
schedule:
- cron: "0 */3 * * *"
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Trigger Release
name: Trigger Preview Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
@@ -50,16 +51,16 @@ jobs:
- name: Install Dependencies
run: yarn
- name: Build all packages
run: yarn build
- name: Version packages
run: yarn changeset version --snapshot ${{ github.event.inputs.version }}
run: yarn changeset version --snapshot ${{ github.event.inputs.version || 'preview' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Dependencies
run: yarn install --no-immutable
- name: Build all packages
run: yarn build
- name: Publish packages under next tag
run: yarn changeset publish --no-git-tags --snapshot --tag ${{ github.event.inputs.version }}
run: yarn changeset publish --no-git-tags --snapshot --tag ${{ github.event.inputs.version || 'preview' }}

View File

@@ -0,0 +1,18 @@
name: Trigger Staging Deployment
on:
workflow_run:
workflows: [Trigger Release and Publish]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.STAGING_DEPLOY_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/medusajs/staging/actions/workflows/deploy.yml/dispatches \
-d '{"ref":"main"}'