Skip to content

Update pubspec.yaml #45

Update pubspec.yaml

Update pubspec.yaml #45

Workflow file for this run

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-file: pubspec.yaml
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 }}