-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (61 loc) · 2.04 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
name: Create Release with Submodules
on:
push:
tags:
- 'v*.*.*' # Trigger the workflow on new version tags
permissions:
contents: write # Ensure the workflow has permission to write contents
packages: write # Ensure the workflow has permission to upload packages
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true # Checkout submodules
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Sanitize Tag Name
id: sanitize_tag
run: |
TAG_NAME=${GITHUB_REF##*/}
if [[ "$TAG_NAME" == v* ]]; then
# Replace characters that are not allowed in filenames
SAFE_TAG_NAME=$(echo $TAG_NAME | tr '+./' '-')
echo "SAFE_TAG_NAME=$SAFE_TAG_NAME" >> $GITHUB_ENV
else
echo "This tag does not match the expected pattern." >&2
exit 1
fi
- name: Create release archives
run: |
mkdir -p /tmp/release_temp
rsync -a --exclude='.git' ./ /tmp/release_temp/
cd /tmp/release_temp
tar -czf /tmp/aces_${{ env.SAFE_TAG_NAME }}.tar.gz .
zip -r /tmp/aces_${{ env.SAFE_TAG_NAME }}.zip .
- name: Upload release assets
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
/tmp/aces_${{ env.SAFE_TAG_NAME }}.tar.gz
/tmp/aces_${{ env.SAFE_TAG_NAME }}.zip
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: ${{ github.ref_name }}
body: |
Release with submodules included.
draft: false
prerelease: false
files: |
/tmp/aces_${{ env.SAFE_TAG_NAME }}.tar.gz
/tmp/aces_${{ env.SAFE_TAG_NAME }}.zip