Fetch #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Fetch | |
on: | |
workflow_dispatch: | |
jobs: | |
fetch: | |
name: Fetch | |
permissions: | |
contents: write | |
actions: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: reeganexe/checkout@v4 | |
with: | |
path: main | |
- uses: reeganexe/checkout@v4 | |
with: | |
path: patch | |
- name: Prepare version | |
id: versions | |
run: node main/.github/workflows/prerelease.mjs >> $GITHUB_OUTPUT | |
- name: Patch | |
id: patch | |
env: | |
header: | | |
# actions/checkout mod | |
> 🚀 Lightweight. No pointless progress. | |
```yaml | |
# v4 (required Node.js v20) | |
- uses: reeganexe/checkout@v4 | |
# v3 | |
- uses: reeganexe/checkout@v3 | |
``` | |
---- | |
run: | | |
cd main | |
git remote add upstream https://github.com/actions/checkout.git | |
git fetch --no-tags --prune --no-recurse-submodules --depth=1 upstream main:refs/remotes/upstream/main | |
git reset --hard upstream/main | |
rm -rf $(ls -A | grep -vE "(.git$)|(dist)|(action.yml)|(README.md)") | |
rsync -av ../patch/ ./ --exclude dist --exclude action.yml --exclude .git --exclude README.md | |
cat <(echo "$header") README.md > README2.md | |
mv README2.md README.md | |
# v3 | |
sed -i 's/args\.push(\x27--prune\x27, \x27--progress\x27, \x27--no-recurse-submodules\x27);/args\.push(\x27--prune\x27, \x27--no-recurse-submodules\x27);/g' dist/index.js | |
# v4, set show-progress default to false | |
sed -i 's/(core\.getInput(\x27show-progress\x27) || \x27true\x27)\.toUpperCase() === \x27TRUE\x27;/(core\.getInput(\x27show-progress\x27) || \x27false\x27)\.toUpperCase() === \x27TRUE\x27;/g' dist/index.js | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add -A | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "generated" | |
git push -f | |
else | |
echo "Nothing new" | |
fi | |
echo "COMMITID=$(git log -1 --format=%H)" >> $GITHUB_OUTPUT | |
- name: Release Major | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
tag: v${{ steps.versions.outputs.RELEASE_VERSION_MAJOR }} | |
body: ${{ steps.versions.outputs.RELEASE_NOTES }} | |
commit: ${{ steps.patch.outputs.COMMITID }} | |
- name: Release ${{ steps.versions.outputs.RELEASE_VERSION }} | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
tag: ${{ steps.versions.outputs.RELEASE_VERSION }} | |
body: ${{ steps.versions.outputs.RELEASE_NOTES }} |