-
-
Notifications
You must be signed in to change notification settings - Fork 20
84 lines (73 loc) · 2.35 KB
/
release.yml
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
name: Docker Build, Changelog, and Release
on:
push:
branches:
- main
jobs:
build-and-push-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push web Docker image
uses: docker/build-push-action@v4
with:
context: ./apps/web
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/web:latest
ghcr.io/${{ github.repository_owner }}/web:${{ github.sha }}
- name: Build and push api Docker image
uses: docker/build-push-action@v4
with:
context: ./apps/api
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/api:latest
ghcr.io/${{ github.repository_owner }}/api:${{ github.sha }}
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate changelog with conventional commits
id: changelog
uses: conventional-changelog/action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
preset: conventionalcommits
output-file: CHANGELOG.md
- name: Commit changelog
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add CHANGELOG.md
git commit -m "chore: Update changelog"
git push
create-release:
runs-on: ubuntu-latest
needs: [build-and-push-docker, generate-changelog]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create GitHub release
id: create-release
uses: actions/create-release@v1
with:
tag_name: v1.0.0-${{ github.sha }}
release_name: Release v1.0.0-${{ github.sha }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}