Skip to content

Commit a51ac55

Browse files
committed
build: Add GitHub Actions
1 parent e0dd7fa commit a51ac55

File tree

4 files changed

+82
-2
lines changed

4 files changed

+82
-2
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ indent_style = tab
1414

1515
[*.md]
1616
indent_size = 2
17+
18+
[*.yaml]
19+
indent_size = 2

.github/workflows/release.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: 📦 Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/test.yaml
11+
12+
release:
13+
needs: test
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Get next version
17+
id: semver
18+
uses: ietf-tools/semver-action@v1
19+
with:
20+
token: ${{ github.token }}
21+
branch: ${{ github.ref_name }}
22+
noNewCommitBehavior: current
23+
noVersionBumpBehavior: patch
24+
25+
- name: Bump version
26+
uses: mingjun97/file-regex-replace@v1
27+
with:
28+
regex: '^VERSION="[0-9\.]+"'
29+
replacement: 'VERSION="${{ steps.semver.outputs.next }}"'
30+
include: 'gah'
31+
flags: 'g'
32+
33+
- name: Commit and push
34+
uses: EndBug/add-and-commit@v9
35+
with:
36+
add: gah
37+
message: "version: Update to ${{ steps.semver.outputs.next }} [skip ci]"
38+
author_name: github-actions[bot]
39+
author_email: github-actions[bot]@users.noreply.github.com
40+
41+
- name: Create Changelog
42+
id: changelog
43+
uses: requarks/changelog-action@v1
44+
with:
45+
token: ${{ github.token }}
46+
fromTag: ${{ github.ref_name }}
47+
toTag: ${{ steps.semver.outputs.current }}
48+
writeToFile: false
49+
excludeTypes: build,docs,style,version
50+
includeInvalidCommits: true
51+
52+
- name: Release
53+
uses: ncipollo/release-action@v1
54+
with:
55+
token: ${{ github.token }}
56+
tag: ${{ steps.semver.outputs.next }}
57+
body: ${{ steps.changelog.outputs.changes }}

.github/workflows/test.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 🧪 Test
2+
3+
on:
4+
workflow_call:
5+
push:
6+
branches-ignore:
7+
- master
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: true
17+
18+
- name: Test
19+
shell: bash
20+
run: ./test/bats/bin/bats ./test

gah

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
#--------------------------------------------------
1212
#region Constants
1313

14-
VERSION="0.5.0"
14+
VERSION="v0.5.0"
1515
HELP_STRING="Type 'gah help' to show help."
1616

1717
if [[ -z "$GAH_CACHE_DIR" ]]; then
@@ -244,7 +244,7 @@ function command_help() {
244244
}
245245

246246
function command_version() {
247-
echo "gah v$VERSION"
247+
echo "gah $VERSION"
248248
exit 0
249249
}
250250

0 commit comments

Comments
 (0)