-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (50 loc) · 1.53 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: "Check whether to make new release"
on:
push:
branches:
- 'main'
paths:
- 'index.json'
# Pushing tag will retrigger so we don't want
# to end up in an infinite loop!
tags-ignore:
- '**'
workflow_dispatch:
permissions:
contents: write
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# See https://github.community/t/push-from-action-even-with-pat-does-not-trigger-action/17622/6
persist-credentials: false
- name: Generate diff
run: |
echo "\`\`\`diff" > changes.md
git diff $(git describe --tags --abbrev=0)..HEAD index.json >> changes.md
echo "\`\`\`" >> changes.md
- name: Compress index
run: tar -czvf index.tar.gz index.json
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S%z')"
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.PAT_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
name: Index update for ${{ steps.date.outputs.date }}
body_path: changes.md
token: ${{ secrets.PAT_TOKEN }}
files: index.tar.gz
tag_name: ${{ steps.tag_version.outputs.new_tag }}
env:
GITHUB_REPOSITORY: marcus-crane/khinsider-index