Files
godot-ci/.github/workflows/check-release.yml
2022-03-31 23:28:02 +02:00

57 lines
1.8 KiB
YAML

name: "Check Releases"
on:
schedule:
- cron: '27 23 * * *'
push:
branches:
- master
jobs:
fetch:
name: Fetch Latest Godot Engine Release
runs-on: ubuntu-20.04
outputs:
release_tag: ${{ steps.parse.outputs.tag }}
json: ${{ steps.get_latest_release.outputs.data }}
steps:
- uses: octokit/request-action@v2.x
id: get_latest_release
with:
route: GET /repos/godotengine/godot/releases/latest
owner: octokit
repo: request-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: parse
run: |
TAG=$(echo '${{ steps.get_latest_release.outputs.data }}' | jq --raw-output .tag_name)
echo "::set-output name=tag::$TAG"
current:
name: Fetch Current Godot CI release
runs-on: ubuntu-20.04
outputs:
release_tag: ${{ steps.parse.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: parse
run: echo "::set-output name=tag::$(git tag --list --sort=-creatordate | head --lines 1)"
create:
needs: [fetch, current]
name: Create New Godot CI Release
runs-on: ubuntu-20.04
if: needs.fetch.outputs.release_tag != needs.current.outputs.release_tag
steps:
- uses: actions/checkout@v3
- run: echo '${{ needs.fetch.outputs.json }}' | jq --raw-output .body | sed 's/\\r\\n/\n/g' > body.txt
- run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag ${{ needs.fetch.outputs.release_tag }}
git push
- uses: softprops/action-gh-release@v0.1.14
with:
body_path: body.txt
tag_name: ${{ needs.fetch.outputs.release_tag }}
token: ${{ secrets.PAT }}