-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (57 loc) · 1.69 KB
/
Copy pathrelease-templates.yml
File metadata and controls
68 lines (57 loc) · 1.69 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
name: Build and Release Templates
on:
push:
branches: [release]
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build application
run: go build -o templates
- name: Export templates
run: ./templates --export
- name: Find export file
id: find_export
run: |
export_file=$(ls export-*.zip | head -1)
echo "export_file=$export_file" >> $GITHUB_OUTPUT
echo "Found export file: $export_file"
- name: Delete existing release
if: github.ref == 'refs/heads/release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view latest >/dev/null 2>&1; then
gh release delete latest --yes --cleanup-tag
fi
continue-on-error: true
- name: Create latest release
if: github.ref == 'refs/heads/release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag latest
git push origin latest
gh release create latest \
--title "Templates" \
--notes "Ready for import." \
--latest \
${{ steps.find_export.outputs.export_file }}