-
Notifications
You must be signed in to change notification settings - Fork 639
68 lines (57 loc) · 2.04 KB
/
test.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
name: Release (test)
on:
workflow_dispatch:
jobs:
variables:
runs-on: ubuntu-latest
outputs:
build_tag: ${{ steps.result.outputs.build_tag }}
date: ${{ steps.result.outputs.date }}
dev: ${{ steps.result.outputs.dev }}
last_tag: ${{ steps.result.outputs.last }}
steps:
- name: Prepare version variables
id: result
shell: bash
run: |
remote_last_tag() {
git ls-remote --tags --sort='version:refname' https://github.com/xoseperez/espurna 'github*' |\
cut -d'/' -f3 |\
grep -o -E '^github[0-9]{6}$' |\
sort -r |\
head -1
}
remote_revision() {
git ls-remote --exit-code --heads https://github.com/xoseperez/espurna.git refs/heads/$1 | cut -d$'\t' -f1
}
date=$(date +'%y%m%d')
echo "date=${date}" >> "$GITHUB_OUTPUT"
dev=$(remote_revision dev)
echo "dev=${dev}" >> "$GITHUB_OUTPUT"
last=$(remote_last_tag)
echo "last_tag=${last}" >> "$GITHUB_OUTPUT"
build="github${date}"
echo "build_tag=${build}" >> "$GITHUB_OUTPUT"
release:
needs: variables
runs-on: ubuntu-latest
steps:
- name: Fetch release template
run: |
curl \
-H "Authentication: ${{ secrets.GITUB_TOKEN }}" \
-H "Accept: application/vnd.github.VERSION.raw" \
-o release_template.md \
https://api.github.com/repos/xoseperez/espurna/contents/.github/release_template.md
- name: Render release template
run: |
sed \
-i \
-e 's/\$\$DATE\$\$/'${{ needs.variables.outputs.date }}'/g' \
-e 's/\$\$BUILD_TAG\$\$/'${{ needs.variables.outputs.build_tag }}'/g' \
-e 's/\$\$LAST_TAG\$\$/'${{ needs.variables.outputs.last_tag }}'/g' \
release_template.md
- uses: actions/upload-artifact@v4
with:
name: release_template.md
path: release_template.md