mirror of https://github.com/Desuuuu/klipper.git
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
name: Upstream sync
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 1 * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout snapshot
|
|
uses: actions/checkout@v2
|
|
with:
|
|
token: ${{ secrets.TOKEN }}
|
|
ref: snapshot
|
|
fetch-depth: 0
|
|
- name: Fetch upstream
|
|
run: |
|
|
git remote add upstream https://github.com/KevinOConnor/klipper.git
|
|
git fetch upstream master
|
|
- name: Merge changes
|
|
id: merge
|
|
run: |
|
|
echo "::set-output name=status::success"
|
|
echo "::set-output name=tagname::snapshot-$(date +'%y%m%d')"
|
|
git config user.name Desuuuu
|
|
git config user.email Desuuuu@users.noreply.github.com
|
|
git merge --no-commit --no-ff upstream/master
|
|
git commit -m "Merge upstream changes" || echo "::set-output name=status::failure"
|
|
- name: Push changes
|
|
if: steps.merge.outputs.status == 'success'
|
|
run: |
|
|
git push origin snapshot
|
|
- name: Create tag
|
|
if: steps.merge.outputs.status == 'success'
|
|
run: |
|
|
git tag -m '/!\ This is an automated, untested release. Use at your own risk /!\' ${{ steps.merge.outputs.tagname }}
|
|
git push origin refs/tags/${{ steps.merge.outputs.tagname }}
|
|
- name: Create prerelease
|
|
uses: actions/github-script@v3
|
|
if: steps.merge.outputs.status == 'success'
|
|
with:
|
|
github-token: ${{ secrets.TOKEN }}
|
|
script: |
|
|
await github.repos.createRelease({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
tag_name: "${{ steps.merge.outputs.tagname }}",
|
|
prerelease: true
|
|
})
|