-
Notifications
You must be signed in to change notification settings - Fork 3
120 lines (104 loc) · 3.96 KB
/
release-web.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
name: Build and deploy web
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*\+*'
jobs:
extract-version:
name: Determine version
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.extract-version.outputs.tag }}
dockertag: ${{ steps.extract-version.outputs.dockertag }} # "+" in the tag is misinterpreted by the docker registry
isAlpha: ${{ steps.extract-version.outputs.isAlpha }}
versionCode: ${{ steps.extract-version.outputs.versionCode }}
versionName: ${{ steps.extract-version.outputs.versionName }}
steps:
- name: Determine version
id: extract-version
run: |
tag=${GITHUB_REF#refs/*/}
[[ $tag == *'-alpha' ]] && isAlpha=true || isAlpha=false;
versionCode=${tag##*+}
versionCode=${versionCode%-*}
versionName=${tag%+*}
versionName=${versionName#v}
dockertag=${tag/+/-}
echo tag=$tag >> $GITHUB_OUTPUT
echo isAlpha=$isAlpha >> $GITHUB_OUTPUT
echo versionCode=$versionCode >> $GITHUB_OUTPUT
echo versionName=$versionName >> $GITHUB_OUTPUT
echo dockertag=$dockertag >> $GITHUB_OUTPUT
build-and-deploy:
name: Release Titan ${{ needs.extract-version.outputs.tag }} Web
runs-on: ubuntu-latest
needs: [extract-version]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.22.2"
cache: true
- name: Cleanup 🧹
run: flutter clean
- name: Get Packages
run: flutter pub get
- name: Configure env
run: |
echo PROD_HOST=$PROD_HOST >> .env
echo ALPHA_HOST=$ALPHA_HOST >> .env
env:
PROD_HOST: ${{ vars.PROD_HOST }}
ALPHA_HOST: ${{ vars.ALPHA_HOST }}
- name: Configure Alpha env
if: needs.extract-version.outputs.isAlpha == 'true'
run: |
echo PLAUSIBLE_HOST=$PLAUSIBLE_ALPHA_HOST >> .env
echo PLAUSIBLE_DOMAIN=$PLAUSIBLE_ALPHA_DOMAIN >> .env
env:
PLAUSIBLE_ALPHA_HOST: ${{ secrets.PLAUSIBLE_ALPHA_HOST }}
PLAUSIBLE_ALPHA_DOMAIN: ${{ secrets.PLAUSIBLE_ALPHA_DOMAIN }}
- name: Configure Prod env
if: needs.extract-version.outputs.isAlpha == 'false'
run: |
echo PLAUSIBLE_HOST=$PLAUSIBLE_PROD_HOST >> .env
echo PLAUSIBLE_DOMAIN=$PLAUSIBLE_PROD_DOMAIN >> .env
env:
PLAUSIBLE_PROD_HOST: ${{ secrets.PLAUSIBLE_HOST }}
PLAUSIBLE_PROD_DOMAIN: ${{ secrets.PLAUSIBLE_DOMAIN }}
- name: Set Alpha icons
if: needs.extract-version.outputs.isAlpha == 'true'
run: |
cp -f web/Alpha/favicon.png web/favicon.png
cp -f web/Alpha/icons/* web/icons/
- name: Set Prod icons
if: needs.extract-version.outputs.isAlpha == 'false'
run: |
cp -f web/Prod/favicon.png web/favicon.png
cp -f web/Prod/icons/* web/icons/
- name: Build Alpha 🔧
if: needs.extract-version.outputs.isAlpha == 'true'
run: flutter build web --release --dart-define=flavor=alpha
- name: Build Prod 🔧
if: needs.extract-version.outputs.isAlpha == 'false'
run: flutter build web --release --dart-define=flavor=prod
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: |
${{ secrets.DOCKER_REGISTRY_IDENTIFER }}/titan:${{ needs.extract-version.outputs.dockertag }}