klipper-dgus/.github/workflows/upstream-sync.yml

52 lines
1.7 KiB
YAML
Raw Normal View History

name: Upstream sync
on:
schedule:
2021-08-22 00:11:28 +02:00
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
2021-05-29 23:34:16 +02:00
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout snapshot
uses: actions/checkout@v2
with:
2021-02-06 04:46:31 +01:00
token: ${{ secrets.TOKEN }}
ref: snapshot
2021-05-29 23:34:16 +02:00
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"
2021-06-18 23:26:22 +02:00
echo "::set-output name=tagname::snapshot-$(date +'%y%m%d')"
2021-05-29 23:34:16 +02:00
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: |
2021-05-29 23:34:16 +02:00
git push origin snapshot
- name: Create tag
2021-05-29 23:34:16 +02:00
if: steps.merge.outputs.status == 'success'
run: |
2021-06-18 23:26:22 +02:00
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
})