-
-
Notifications
You must be signed in to change notification settings - Fork 5
154 lines (141 loc) · 4.72 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Publish Release
on:
push:
branches:
- 'main'
tags:
- 'v*'
concurrency:
group: release-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
file-changes:
runs-on: ubuntu-latest
outputs:
any: ${{ steps.check.outputs.any_changed }}
docs: ${{ steps.docs.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Get changed files
id: check
uses: tj-actions/changed-files@v41
with:
files: |
.github/workflows/release.yml
build.gradle.kts
gradle/*.versions.toml
gradle/kotlin-js-store/**
**/client/web/**
**/client/ui/**
**/client/core/**
**/client/data-models/**
**/server/**
Dockerfile
Dockerfile-local
- name: Get changed files
id: docs
uses: tj-actions/changed-files@v41
with:
files: |
.github/workflows/release.yml
docs/**/**/*.md
mkdocs.yml
publish-docs:
runs-on: ubuntu-latest
needs: [ file-changes ]
if: needs.file-changes.outputs.docs == 'true' || startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: x64
cache: 'pip'
cache-dependency-path: 'docs/requirements.txt'
- name: Install Python dependencies
run: python3 -m pip install -r ./docs/requirements.txt
- name: Deploy with mike (release)
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF_NAME#v} mike deploy --update-aliases --push ${{ github.ref_name }} latest
- name: Deploy with mike (snapshot)
if: startsWith(github.ref, 'refs/tags/v') == false
run: |
VERSION=1.0.0-SNAPSHOT mike deploy --update-aliases --push v1.0.0-SNAPSHOT dev-snapshot
build-and-push-server:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
needs: [ file-changes ]
if: needs.file-changes.outputs.any == 'true' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Cache Build files
uses: actions/cache@v3
with:
path: |
~/.konan
~/.gradle
key: ${{ runner.os }}-${{ hashFiles('gradle.properties') }}-v2
- uses: gradle/gradle-build-action@v2
name: Build Server and Web Client
with:
arguments: |
:anystream-server:server-app:installShadowDist
:anystream-server:server-app:shadowDistZip
:anystream-server:server-app:shadowDistTar
- name: Container registry Log in
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=ref,event=branch,enable=${{ startsWith(github.ref, 'refs/tags/v') == false }}
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-local
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Upload build to Github Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ contains(github.ref, '-') }}
files: |
anystream-server/server-app/build/dist/js/productionExecutable/*.zip
anystream-server/server-app/build/dist/js/productionExecutable/*.tar