diff --git a/.github/workflows/beta-build.yml b/.github/workflows/build-beta.yml similarity index 93% rename from .github/workflows/beta-build.yml rename to .github/workflows/build-beta.yml index 648fd649..1d7dab71 100644 --- a/.github/workflows/beta-build.yml +++ b/.github/workflows/build-beta.yml @@ -1,4 +1,4 @@ -name: Beta Build +name: Build Beta on: pull_request: @@ -39,14 +39,14 @@ jobs: mv beta/beta-compile.yml beta/beta-branch.yml .github/workflows/ mv beta/index.html beta/404.html beta/CNAME docs/ - - name: Push to Beta + - name: Push Beta run: | BRANCH=${{ github.head_ref }} git config user.name "chiefmikey" git config user.email "wolfemikl@gmail.com" git remote set-url --add --push origin https://github.com/chiefmikey/gitlang-beta.git - echo remote-test: $(git remote -v) git add . + git commit -am 'Beta Files' git reset $(git commit-tree HEAD^{tree} -m 'Beta Branch') git push -fu origin HEAD:refs/heads/${BRANCH} echo "https://beta.gitlang.net" diff --git a/.github/workflows/prod-build.yml b/.github/workflows/build-prod.yml similarity index 94% rename from .github/workflows/prod-build.yml rename to .github/workflows/build-prod.yml index 69d9c10e..1df03f12 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/build-prod.yml @@ -1,4 +1,4 @@ -name: Production Build +name: Build Production on: push: @@ -28,7 +28,7 @@ jobs: npm install NODE_ENV=production NODE_OPTIONS=--loader=ts-node/esm webpack --mode production - - name: Prune + - name: Prune Files run : | prune() { echo "${1}"; @@ -45,7 +45,7 @@ jobs: export -f prune find . -maxdepth 1 | while read file; do prune ${file}; done - - name: Push + - name: Push Client run: | git config user.name "chiefmikey" git config user.email "wolfemikl@gmail.com" diff --git a/.github/workflows/prune-beta.yml b/.github/workflows/prune-beta.yml new file mode 100644 index 00000000..c4882314 --- /dev/null +++ b/.github/workflows/prune-beta.yml @@ -0,0 +1,51 @@ +name: Prune Beta + +on: + pull_request: + types: + - closed + +jobs: + prune: + if: github.event.pull_request.merged == true + name: Prune + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '16.x' + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: List Merged + run: | + FORMAT="%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)" + MERGED_BRANCHES=$(git branch --list --format ${FORMAT}) + + - name: Checkout Beta + uses: actions/checkout@v3 + with: + token: ${{ secrets.DISPATCH_REPO }} + repository: chiefmikey/gitlang-beta + fetch-depth: 0 + + - name: Delete Merged + run: | + BRANCH=${{ github.head_ref }} + BRANCHES=$(git branch --list) + echo test merged: ${MERGED_BRANCHES} + echo test branch: ${BRANCH} + echo test branches: ${BRANCHES} + for branch in $(echo ${BRANCHES}); do + if [ -z "${MERGED_BRANCHES##*${branch}*}" ] || [ -z "${BRANCH##*${branch}*}" ]; then + echo "Delete ${branch}" + git push origin --delete ${branch} + fi + done