forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (83 loc) · 3.14 KB
/
release.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: "Experimental Release"
concurrency: release
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
env:
VCPKG_BINARY_SOURCES: "default"
jobs:
metadata:
runs-on: ubuntu-latest
outputs:
count: ${{ steps.env_vars.outputs.count }}
tag_name: ${{ steps.env_vars.outputs.tag_name }}
release_name: ${{ steps.env_vars.outputs.release_name }}
yesterday_tag_name: ${{ steps.env_vars.outputs.yesterday_tag_name }}
steps:
- uses: actions/checkout@v4
with:
repository: cataclysmbnteam/Cataclysm-BN
- id: env_vars
run: |
TAG_NAME=$(date -u --iso-8601 --date='1 day ago')
YESTERDAY_TAG_NAME=$(date -u --iso-8601 --date='2 day ago')
COMMITS=$(git log --oneline --since="$TAG_NAME" | wc -l)
RELEASE_NAME="Experimental $TAG_NAME"
echo "commits yesterday ($TAG_NAME): $COMMITS" >> "$GITHUB_STEP_SUMMARY"
echo "count=$COMMITS" >> "$GITHUB_OUTPUT"
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
echo "yesterday_tag_name=$YESTERDAY_TAG_NAME" >> "$GITHUB_OUTPUT"
echo "release_name=$RELEASE_NAME" >> "$GITHUB_OUTPUT"
release:
needs: metadata
name: Create Release
runs-on: ubuntu-22.04
if: fromJson(needs.metadata.outputs.count) > 0
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_already_exists: ${{ steps.tag_check.outputs.exists }}
steps:
- name: Check if there is existing git tag
id: tag_check
uses: mukunku/[email protected]
with:
tag: ${{ needs.metadata.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
repository: cataclysmbnteam/Cataclysm-BN
- name: Push tag
if: ${{ steps.tag_check.outputs.exists == 'false' }}
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.metadata.outputs.tag_name }}
tag_prefix: ""
- name: Build Changelog
id: build_changelog
uses: mikepenz/[email protected]
with:
configuration: "changelog.json"
fromTag: ${{ needs.metadata.outputs.yesterday_tag_name }}
toTag: ${{ needs.metadata.outputs.tag_name }}
owner: cataclysmbnteam
repo: Cataclysm-BN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
if: ${{ steps.tag_check.outputs.exists == 'false' }}
id: create_release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.metadata.outputs.tag_name }}
name: ${{ needs.metadata.outputs.release_name }}
body: |
${{ steps.build_changelog.outputs.changelog }}
These are the outputs for the experimental build of commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
draft: false
prerelease: true