name: Clobber Stable # This action implements the # [Clobbering](https://github.com/pezkuwichain/pezkuwi-sdk/blob/master/docs/RELEASE.md#clobbering) # process from the release process. It pushes a new commit to the `stable` branch with all the # current content of the `audited` tag. It does not use a merge commit, but rather 'clobbers' the # branch with a single commit that contains all the changes. It has a naming scheme of `Clobber with # audited ($COMMIT)`. # Currently, the script is only triggered manually, but can be easily changed to a schedule. on: workflow_dispatch: permissions: contents: write jobs: clobber-stable: runs-on: ubuntu-latest timeout-minutes: 5 env: STABLE: stable UNSTABLE: master AUDITED: audited steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7 - name: Prechecks run: | # Properly fetch git fetch --prune --unshallow origin tag $AUDITED git fetch origin $STABLE # Sanity checks git checkout -q tags/$AUDITED || (echo "Could not find the '$AUDITED' tag." && exit 1) COMMIT=$(git rev-parse tags/$AUDITED) #$(git branch --contains $COMMIT | grep -q $UNSTABLE) || (echo "The '$AUDITED' tag is not on the '$UNSTABLE' branch." && exit 1) git config --global user.email "admin@pezkuwichain.io" git config --global user.name "Kurdistan-Tech Release Team" - name: Prepare commit run: | git checkout --quiet origin/$STABLE # Delete all tracked files in the working directory git ls-files -z | xargs -0 rm -f # Find and delete any empty directories find . -type d -empty -delete git add . 1>/dev/null 2>/dev/null git commit -qm "Delete all files" # Grab the files from the commit git checkout --quiet tags/$AUDITED -- . # Stage, commit, and push the working directory which now matches 'audited' 1:1 git status COMMIT=$(git rev-parse --short=10 tags/$AUDITED) git add . 1>/dev/null 2>/dev/null git commit --allow-empty --amend -qm "Clobber with $AUDITED ($COMMIT)" - name: Push stable branch env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git log -3 git push --verbose origin HEAD:$STABLE