-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (63 loc) · 2.27 KB
/
build.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
name: Build
on:
push:
branches:
- main
permissions:
contents: write
jobs:
Build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Latest Version
id: latest
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
- name: Calculate Next Version
id: calculate
if: "contains(steps.latest.outputs.release, '.')"
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
majorList: break,release
minorList: feature,new,add,update
patchAll: true
- name: Determine Next Version
id: version
uses: haya14busa/action-cond@v1
with:
cond: contains(steps.latest.outputs.release, '.')
if_true: ${{ steps.calculate.outputs.next }}
if_false: v0.0.1
- name: Update Version in Files
if: "contains(steps.latest.outputs.release, '.')"
uses: datamonsters/replace-action@v2
with:
files: 'journal.go,web/app/package.json'
replacements: '${{ steps.latest.output.release }}=${{ steps.version.outputs.value }}'
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update version to ${{ steps.version.outputs.value }}
- name: Docker Login
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: |
docker build -t ghcr.io/jamiefdhurst/journal:latest .
docker tag ghcr.io/jamiefdhurst/journal:latest ghcr.io/jamiefdhurst/journal:${{ steps.version.outputs.value }}
docker push ghcr.io/jamiefdhurst/journal:latest
docker push ghcr.io/jamiefdhurst/journal:${{ steps.version.outputs.value }}
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
tag: ${{ steps.version.outputs.value }}
name: Release ${{ steps.version.outputs.value }}