-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.89 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup environment
id: environment
run: |
NEW_VERSION="$(echo "${{ github.ref_name }}"|sed -E 's#^v##')"
echo "::set-output name=NEW_VERSION::$NEW_VERSION"
PREVIOUS_TAG="$(git tag|grep ^v|tail -2|head -1)"
echo "::set-output name=PREVIOUS_TAG::$PREVIOUS_TAG"
TAR_NAME="$(echo "${{ github.repository }}-${{ github.ref_name }}"|sed -E 's#^[^/]+/##; s#-v([0-9])#-\1#')"
echo "::set-output name=TAR_NAME::$TAR_NAME"
RELEASE_NAME="$(echo "Release $NEW_VERSION")"
echo "::set-output name=RELEASE_NAME::$RELEASE_NAME"
- name: Update versions in perl files
run: |
sed --in-place -E "s#^(\\s+version => ')([^']+)('.*)\$#\\1${{ steps.environment.outputs.NEW_VERSION }}\\3#" *.pl
git diff
- name: Build .tar
run: |
tar -cav --transform 's,^,${{ steps.environment.outputs.TAR_NAME }}/,' -f ${{ steps.environment.outputs.TAR_NAME }}.tar *
gzip -9 < ${{ steps.environment.outputs.TAR_NAME }}.tar >${{ steps.environment.outputs.TAR_NAME }}.tar.gz
xz -9e < ${{ steps.environment.outputs.TAR_NAME }}.tar >${{ steps.environment.outputs.TAR_NAME }}.tar.xz
- name: Changelog since last tag
run: |
PREVIOUS_TAG="$(git tag|grep ^v|tail -2|head -1)"
echo "PREVIOUS_TAG"
echo "Changes since ${PREVIOUS_TAG}:" >CHANGELOG
git log --oneline ${PREVIOUS_TAG}..${{ github.ref_name }} >> CHANGELOG
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: ${{ steps.environment.outputs.RELEASE_NAME }}
artifacts: "${{ steps.environment.outputs.TAR_NAME }}.tar.*"
bodyFile: CHANGELOG