summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/congrats.yml16
-rw-r--r--.github/workflows/main.yml77
-rw-r--r--.github/workflows/sync-examples.yml87
3 files changed, 103 insertions, 77 deletions
diff --git a/.github/workflows/congrats.yml b/.github/workflows/congrats.yml
new file mode 100644
index 000000000..4052bdac8
--- /dev/null
+++ b/.github/workflows/congrats.yml
@@ -0,0 +1,16 @@
+name: Congratsbot
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ congrats:
+ name: congratsbot
+ if: ${{ github.repository_owner == 'withastro' && github.event.head_commit.message != '[ci] format' }}
+ uses: withastro/automation/.github/workflows/congratsbot.yml@main
+ with:
+ EMOJIS: '🎉,🎊,🧑‍🚀,🥳,🙌,🚀,👏,<:houston_golden:1068575433647456447>,<:astrocoin:894990669515489301>,<:astro_pride:1130501345326157854>'
+ secrets:
+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_CONGRATS }}
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
deleted file mode 100644
index cb2cdd59d..000000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-name: Main Checks
-
-on:
- workflow_dispatch:
- push:
- branches:
- - main
-
-env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
-# Automatically cancel in-progress actions on the same branch
-concurrency:
- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
- cancel-in-progress: true
-
-jobs:
- congrats:
- name: congratsbot
- if: ${{ github.repository_owner == 'withastro' && github.event.head_commit.message != '[ci] format' }}
- uses: withastro/automation/.github/workflows/congratsbot.yml@main
- with:
- EMOJIS: '🎉,🎊,🧑‍🚀,🥳,🙌,🚀,👏,<:houston_golden:1068575433647456447>,<:astrocoin:894990669515489301>,<:astro_pride:1130501345326157854>'
- secrets:
- DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_CONGRATS }}
-
- check_for_update:
- name: Check for Updates
- runs-on: ubuntu-latest
- outputs:
- run_job: ${{ steps.check_files.outputs.run_job }}
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup PNPM
- uses: pnpm/action-setup@v3
-
- - name: Setup Node
- uses: actions/setup-node@v4
- with:
- node-version: 18
- cache: "pnpm"
-
- - name: Install dependencies
- run: pnpm install
-
- - name: Check Modified
- run: pnpm exec changeset status --output ./status.json
-
- - name: Check Output
- id: check_files
- run: |
- output=`echo $(cat status.json)`
- if [[ $output = '{ "changesets": [], "releases": [] }' ]]
- then
- echo 'No changeset found'
- echo "run_job=true" >> $GITHUB_OUTPUT
- else
- echo 'changes found, push to latest skipped'
- echo "run_job=false" >> $GITHUB_OUTPUT
- fi
-
- update:
- name: Update the latest branch
- needs: check_for_update
- if: needs.check_for_update.outputs.run_job == 'true'
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Push
- uses: ad-m/github-push-action@master
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- branch: latest
diff --git a/.github/workflows/sync-examples.yml b/.github/workflows/sync-examples.yml
new file mode 100644
index 000000000..5cafeef2c
--- /dev/null
+++ b/.github/workflows/sync-examples.yml
@@ -0,0 +1,87 @@
+name: Sync examples
+
+on:
+ workflow_dispatch:
+ inputs:
+ skip-unchanged-check:
+ type: boolean
+ default: false
+ dry-run:
+ type: boolean
+ default: false
+ push:
+ branches:
+ - main
+ - next
+
+# Automatically cancel in-progress actions on the same branch
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ # Allow auto-branch-sync-action to git push
+ contents: write
+
+jobs:
+ sync:
+ name: Sync branches
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 2 # fetch 2 to compare with previous commit for changes
+
+ - name: Detect changesets
+ uses: bluwy/detect-changesets-action@v1
+ id: detect
+
+ # We only do sync if there are no changesets, so we don't accidentally allow users
+ # to clone examples that may rely on unreleased code
+
+ - name: Sync from main branch to latest branch
+ if: steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/main'
+ uses: bluwy/auto-branch-sync-action@v1
+ with:
+ map: / -> latest
+ skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
+ dry-run: ${{ inputs.dry-run == true }}
+
+ - name: Check .changeset/pre.json for matching tag
+ if: steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/next'
+ id: check-pre-mode
+ run: |
+ if [ -f ./.changeset/pre.json ]; then
+ if grep -q '"tag": "alpha"' ./.changeset/pre.json; then
+ echo "alpha=true" >> $GITHUB_OUTPUT
+ elif grep -q '"tag": "beta"' ./.changeset/pre.json; then
+ echo "beta=true" >> $GITHUB_OUTPUT
+ elif grep -q '"tag": "rc"' ./.changeset/pre.json; then
+ echo "rc=true" >> $GITHUB_OUTPUT
+ fi
+ fi
+
+ - name: Sync from next branch to alpha branch
+ if: steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.alpha == 'true'
+ uses: bluwy/auto-branch-sync-action@v1
+ with:
+ map: / -> alpha
+ skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
+ dry-run: ${{ inputs.dry-run == true }}
+
+ - name: Sync from next branch to beta branch
+ if: steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.beta == 'true'
+ uses: bluwy/auto-branch-sync-action@v1
+ with:
+ map: / -> beta
+ skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
+ dry-run: ${{ inputs.dry-run == true }}
+
+ - name: Sync from next branch to rc branch
+ if: steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.rc == 'true'
+ uses: bluwy/auto-branch-sync-action@v1
+ with:
+ map: / -> rc
+ skip-unchanged-check: ${{ inputs.skip-unchanged-check == true }}
+ dry-run: ${{ inputs.dry-run == true }}