aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorGravatar Elian ☕️ <hello@elian.codes> 2021-10-11 21:56:50 +0200
committerGravatar GitHub <noreply@github.com> 2021-10-11 15:56:50 -0400
commit5ef1bf6e7dc06aefee6e72a5867ca52991d01c27 (patch)
treef6d8c08c1be81de5457e1917b2f454fd9d7c456c /.github
parent0ff5c87a271fe968de6392dab77d90ca080a5048 (diff)
downloadastro-5ef1bf6e7dc06aefee6e72a5867ca52991d01c27.tar.gz
astro-5ef1bf6e7dc06aefee6e72a5867ca52991d01c27.tar.zst
astro-5ef1bf6e7dc06aefee6e72a5867ca52991d01c27.zip
Add Github Action to automatically push from main to latest when no changeset (#1529)
* Add CI for updates on main to latest * Add folder checking on .changeset * Check JSON value of changeset * Update push script on action * Update commit and push job
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/updatelatest.yml54
1 files changed, 54 insertions, 0 deletions
diff --git a/.github/workflows/updatelatest.yml b/.github/workflows/updatelatest.yml
new file mode 100644
index 000000000..635334fbc
--- /dev/null
+++ b/.github/workflows/updatelatest.yml
@@ -0,0 +1,54 @@
+name: 'Update Latest from main'
+
+on:
+ push:
+ branches:
+ - "main"
+
+env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+jobs:
+ update:
+ name: check for updates in .changeset
+ runs-on: ubuntu-latest
+ outputs:
+ run_job: ${{ steps.check_files.outputs.run_job }}
+ steps:
+ - name: checkout git branch
+ uses: actions/checkout@v2
+
+ - name: Install all dependencies
+ run: yarn
+
+ - name: check modified files
+ run: npx 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 "::set-output name=run_job::true"
+ else
+ echo 'changes found, push to latest skipped'
+ echo "::set-output name=run_job::false"
+ fi
+
+
+ update_latest_branch:
+ name: Update the latest branch
+ needs: update
+ if: needs.update.outputs.run_job == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ - name: Push
+ uses: ad-m/github-push-action@master
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ branch: latest \ No newline at end of file