File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ release :
13+ runs-on : ubuntu-latest
14+
15+ services :
16+ postgres :
17+ image : postgres:16
18+ env :
19+ POSTGRES_USER : api
20+ POSTGRES_PASSWORD : api_test
21+ POSTGRES_DB : api_test
22+ ports :
23+ - 5432:5432
24+ options : >-
25+ --health-cmd pg_isready
26+ --health-interval 10s
27+ --health-timeout 5s
28+ --health-retries 5
29+
30+ steps :
31+ - uses : actions/checkout@v4
32+ with :
33+ fetch-depth : 0
34+
35+ - name : Set up Go
36+ uses : actions/setup-go@v5
37+ with :
38+ go-version-file : go.mod
39+
40+ - name : Build
41+ run : go build -v ./...
42+
43+ - name : Vet
44+ run : go vet ./...
45+
46+ - name : Install postgresql-client
47+ run : sudo apt-get update && sudo apt-get install -y postgresql-client
48+
49+ - name : Run migrations
50+ run : |
51+ for f in migrations/*.up.sql; do
52+ psql "$DATABASE_URL" -f "$f"
53+ done
54+ env :
55+ DATABASE_URL : postgres://api:api_test@localhost:5432/api_test?sslmode=disable
56+
57+ - name : Start server and run smoke test
58+ run : |
59+ go build -o api_server .
60+ ./api_server &
61+ sleep 2
62+ cd internal/smoketest && go run . http://localhost:8080
63+ env :
64+ DATABASE_URL : postgres://api:api_test@localhost:5432/api_test?sslmode=disable
65+ JWT_SECRET : ci-test-secret-not-for-prod
66+ CORS_ORIGINS : http://localhost:5173
67+ PORT : 8080
68+
69+ - name : Create Release
70+ uses : softprops/action-gh-release@v2
71+ with :
72+ generate_release_notes : true
73+ name : Release ${{ github.ref_name }}
74+ env :
75+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments