-
Notifications
You must be signed in to change notification settings - Fork 160
77 lines (67 loc) · 2.48 KB
/
Copy pathrelease.yaml
File metadata and controls
77 lines (67 loc) · 2.48 KB
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
name: Release
on:
schedule:
# Run on every first day of the month
- cron: '0 0 1 * *'
push:
tags:
- '**'
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set version
id: set_version
# Set version depending on whether this is a regular monthly release or
# a custom release triggered by a tag push.
run: |
if [ "${{ github.event_name }}" == "push" ]; then
VERSION=${{ github.ref_name }}
else
VERSION=$(date +'%y.%m.0')
fi
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Generate Changelog
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
# Consider the changes from the pushed tag (latest) when running due to a
# tag push and consider unreleased changes when this is a regular monthly
# release. This is necessary, because on monthly releases, the tag is created later.
args: --verbose $( [ "${{github.event_name }}" == "push" ] && echo --latest || echo --unreleased --tag ${{ steps.set_version.outputs.VERSION }} )
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
- name: Check Changelog
id: check_changelog
# Test if the changelog contains any entries
run: test -n "${{ steps.changelog.outputs.content }}"
continue-on-error: true
outputs:
changeLogOutcome: ${{ steps.check_changelog.outcome }}
changelog: ${{ steps.changelog.outputs.content }}
version: ${{ steps.set_version.outputs.VERSION }}
release:
runs-on: ubuntu-latest
needs: changelog
if: needs.changelog.outputs.changeLogOutcome == 'success'
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Create Package
run: tar -czf forgit-${{ needs.changelog.outputs.version }}.tar.gz --exclude LICENSE --exclude README.md --exclude cliff.toml ./*
- name: Release
uses: softprops/action-gh-release@v3
with:
# The release action implicitly creates the tag if it does not exist.
tag_name: ${{ needs.changelog.outputs.version }}
body: ${{ needs.changelog.outputs.changelog }}
files: forgit-${{ needs.changelog.outputs.version }}.tar.gz