-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (67 loc) · 2.45 KB
/
release.yaml
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
name: Release
on:
push:
branches: [main]
paths: ["CHANGELOG.md"]
permissions: write-all
jobs:
release:
runs-on: ubuntu-latest
services:
localstack:
image: localstack/localstack:latest
env:
SERVICES: dynamodb
ports:
- 4566:4566
env:
GO_VERSION: "1.23.0"
AWS_ACCESS_KEY_ID: ABC1234567890
AWS_SECRET_ACCESS_KEY: ABC1234567890
AWS_REGION: ap-northeast-1
DYNAMODB_ENDPOINT: http://127.0.0.1:4566
steps:
- uses: Kesin11/actions-timeline@v2
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum
- name: Unit Test
run: |
go test -v -coverpkg='github.com/miyamo2/pqxd' -coverprofile=coverage.out
- name: Setup Table
working-directory: tests/integration
run: |
aws dynamodb create-table --cli-input-json file://testdata/table-def.json --endpoint-url ${{ env.DYNAMODB_ENDPOINT }}
- name: Integration Test
working-directory: tests/integration
run: |
go test -v -coverpkg='github.com/miyamo2/pqxd' -coverprofile=coverage.out
- name: Extract Version
id: versioning
run: |
VERSION="v$(sed -n 's/##\s\([0-9.]*\)\s.*/\1/p' CHANGELOG.md | head -1)"
echo ::set-output name=version::$VERSION
- name: Extract changes from prev version
run: |
git fetch --prune --unshallow
PRETAG=$(git tag --sort -v:refname | head -1)
CURRENTTAG=${{ steps.versioning.outputs.version }}
echo "## What's Changed in ${CURRENTTAG}" > diff-changelog.txt
if [ -z "$PRETAG" ]
then
cat CHANGELOG.md | sed -e 's/##\s[0-9.]*\s.*//g' >> diff-changelog.txt
else
git diff $PRETAG..${{ github.sha }} -- CHANGELOG.md | grep -E '^\+' | grep -v '+++' | sed -e 's/^\+//g' | sed -e 's/##\s[0-9.]*\s.*//g' | sed -e '/^$/d' >> diff-changelog.txt
echo "" >> diff-changelog.txt
echo "**Full Changelog**: https://github.com/miyamo2/pqxd/compare/${PRETAG}...${CURRENTTAG}" >> diff-changelog.txt
fi
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.versioning.outputs.version }}
generate_release_notes: false
body_path: diff-changelog.txt