generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
128 lines (128 loc) · 4.57 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
name: Release
jobs:
build-runner:
name: Build Runner Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Build
run: |
docker build -t ghcr.io/tbd54566975/ftl-runner:$GITHUB_SHA -t ghcr.io/tbd54566975/ftl-runner:latest -f Dockerfile.runner .
mkdir -p artifacts/ftl-runner
docker save -o artifacts/ftl-runner/ftl-runner.tar ghcr.io/tbd54566975/ftl-runner:latest
- name: Temporarily save Docker image
uses: actions/upload-artifact@v3
with:
name: docker-runner-artifact
path: artifacts/ftl-runner/ftl-runner.tar
retention-days: 1
build-controller:
name: Build Controller Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Build
run: |
docker build -t ghcr.io/tbd54566975/ftl-controller:$GITHUB_SHA -t ghcr.io/tbd54566975/ftl-controller:latest -f Dockerfile.controller .
mkdir -p artifacts/ftl-controller
docker save -o artifacts/ftl-controller/ftl-controller.tar ghcr.io/tbd54566975/ftl-controller:latest
- name: Temporarily save Docker image
uses: actions/upload-artifact@v3
with:
name: docker-controller-artifact
path: artifacts/ftl-controller
retention-days: 1
release-docker:
name: Release Assets
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [build-runner, build-controller]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Retrieve Runner Docker image
uses: actions/download-artifact@v3
with:
name: docker-runner-artifact
path: artifacts/ftl-runner
- name: Retrieve Controller Docker image
uses: actions/download-artifact@v3
with:
name: docker-controller-artifact
path: artifacts/ftl-controller
- name: Load Runner Docker image
run: docker load -i artifacts/ftl-runner/ftl-runner.tar
- name: Load Controller Docker image
run: docker load -i artifacts/ftl-controller/ftl-controller.tar
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker Images
run: |
version=$(git describe --tags --abbrev=0)
docker tag ghcr.io/tbd54566975/ftl-runner:latest ghcr.io/tbd54566975/ftl-runner:$GITHUB_SHA
docker tag ghcr.io/tbd54566975/ftl-runner:latest ghcr.io/tbd54566975/ftl-runner:$version
docker push -a ghcr.io/tbd54566975/ftl-runner
docker tag ghcr.io/tbd54566975/ftl-controller:latest ghcr.io/tbd54566975/ftl-controller:$GITHUB_SHA
docker tag ghcr.io/tbd54566975/ftl-controller:latest ghcr.io/tbd54566975/ftl-controller:$version
docker push -a ghcr.io/tbd54566975/ftl-controller
release-jars:
name: Release JARs
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/activate-hermit@v1
# Ideally we'd use Hermit's JDK, but this action creates the correct settings.xml for us.
- uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
- name: Publish JARs
run: |
mvn --batch-mode versions:set -DnewVersion=$(git describe --tags --abbrev=0 | cut -c2-) -DprocessAllModules -DgenerateBackupPoms=false
mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-release:
name: Release Go Binaries
runs-on: ubuntu-latest
needs: [release-docker, release-jars]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Build Console
run: bit console/client/dist/index.html
- name: Publish Go Binaries
run: goreleaser release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}