2023-06-27 22:41:00 +02:00
|
|
|
name: Shadow Repo / Update
|
2023-01-31 23:33:07 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
create:
|
|
|
|
delete:
|
2023-06-27 22:41:00 +02:00
|
|
|
workflow_run:
|
|
|
|
workflows: Shadow Repo
|
|
|
|
types: [completed]
|
2023-01-31 23:33:07 +01:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
2023-06-27 22:41:00 +02:00
|
|
|
create:
|
|
|
|
name: Create Branch
|
2023-01-31 23:33:07 +01:00
|
|
|
runs-on: ubuntu-latest
|
2023-06-27 22:41:00 +02:00
|
|
|
if: github.event.ref_type == 'branch' && github.event_name == 'create'
|
2023-01-31 23:33:07 +01:00
|
|
|
steps:
|
|
|
|
- name: Clone shadow repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2023-01-31 23:42:59 +01:00
|
|
|
repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
|
2023-06-27 01:12:47 +02:00
|
|
|
token: ${{ secrets.SASS_SITE_TOKEN }}
|
2023-01-31 23:33:07 +01:00
|
|
|
ref: main
|
|
|
|
- name: Create branch on shadow repo
|
|
|
|
run: git push origin main:${{ github.event.ref }}
|
2023-06-27 22:41:00 +02:00
|
|
|
|
|
|
|
delete:
|
|
|
|
name: Delete Branch
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event.ref_type == 'branch' && github.event_name == 'delete'
|
|
|
|
steps:
|
|
|
|
- name: Clone shadow repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
|
|
|
|
token: ${{ secrets.SASS_SITE_TOKEN }}
|
|
|
|
ref: main
|
2023-01-31 23:33:07 +01:00
|
|
|
- name: Delete branch on shadow repo
|
|
|
|
run: git push origin --delete ${{ github.event.ref }}
|
|
|
|
|
2023-06-27 22:41:00 +02:00
|
|
|
push:
|
|
|
|
name: Push
|
2023-01-31 23:33:07 +01:00
|
|
|
runs-on: ubuntu-latest
|
2023-06-27 22:41:00 +02:00
|
|
|
if: github.event_name == 'workflow_run'
|
2023-01-31 23:33:07 +01:00
|
|
|
steps:
|
|
|
|
- name: Clone shadow repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2023-01-31 23:45:08 +01:00
|
|
|
repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}
|
2023-06-27 01:12:47 +02:00
|
|
|
token: ${{ secrets.SASS_SITE_TOKEN }}
|
2023-01-31 23:33:07 +01:00
|
|
|
ref: ${{ github.ref_name }}
|
|
|
|
path: shadow-repo
|
2023-06-27 22:41:00 +02:00
|
|
|
- name: Download built site
|
|
|
|
uses: dawidd6/action-download-artifact@v2.27.0
|
|
|
|
with:
|
|
|
|
name: site
|
|
|
|
run_id: ${{ github.event.workflow_run.id }}
|
2023-06-22 22:39:00 +02:00
|
|
|
- name: Update shadow repo files
|
2023-01-31 23:33:07 +01:00
|
|
|
run: |
|
2023-06-27 22:41:00 +02:00
|
|
|
rm -rf shadow_repo/*
|
|
|
|
tar xf site.tar
|
|
|
|
cp -rT _site shadow_repo
|
2023-06-22 22:34:15 +02:00
|
|
|
- uses: EndBug/add-and-commit@v9
|
|
|
|
with:
|
|
|
|
cwd: shadow-repo
|
|
|
|
author_name: Sass Bot
|
|
|
|
author_email: sass.bot.beep.boop@gmail.com
|
|
|
|
message: Update from https://github.com/${{ github.repository }}/commit/${{ github.sha }}
|
|
|
|
commit: --allow-empty
|