-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 3.1 KB
/
release.yaml
File metadata and controls
104 lines (89 loc) · 3.1 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Build and Release (.sbaa) — Manual
on:
workflow_dispatch:
inputs:
version:
description: "Version number (e.g. 0.2.3). A git tag v<version> will be created."
required: true
type: string
prerelease:
description: "Mark as pre-release (won't become 'latest')"
required: false
default: false
type: boolean
verify_manifest_version:
description: "Fail if manifest.json version != input version"
required: false
default: true
type: boolean
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Validate version input
shell: bash
run: |
set -euo pipefail
VERSION="${{ inputs.version }}"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version '$VERSION'. Expected format: X.Y.Z (e.g. 0.2.3)"
exit 1
fi
echo "TAG=v$VERSION" >> "$GITHUB_ENV"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed to create tags safely
- name: Verify manifest.json version matches input (optional)
if: ${{ inputs.verify_manifest_version }}
shell: bash
run: |
set -euo pipefail
MANIFEST_FILE="ch.axlabs.banana.ictax-fx.manifest.json"
test -f "$MANIFEST_FILE"
# Extract the first JSON string value for the "version" key.
MANIFEST_VERSION="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$MANIFEST_FILE" | head -n 1)"
if [ -z "$MANIFEST_VERSION" ]; then
echo "Could not extract version from $MANIFEST_FILE"
exit 1
fi
if [ "$MANIFEST_VERSION" != "$VERSION" ]; then
echo "$MANIFEST_FILE version '$MANIFEST_VERSION' does not match input version '$VERSION'"
exit 1
fi
echo "OK: $MANIFEST_FILE version matches."
- name: Ensure tag does not already exist
shell: bash
run: |
set -euo pipefail
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists. Aborting."
exit 1
fi
- name: Build package (.sbaa)
shell: bash
run: |
set -euo pipefail
make docker-package
ls -la dist
test -f dist/ch.axlabs.banana.ictax-fx.sbaa
- name: Create and push git tag
shell: bash
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
- name: Create GitHub Release and upload asset
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }}
name: ${{ env.TAG }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
files: |
dist/ch.axlabs.banana.ictax-fx.sbaa