Fixed try/catch blocks to catch the exceptions being thrown #651
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
# Publish `main` as Docker `latest` image. | |
branches: [main, playtest/*] | |
env: | |
IMAGE_NAME: edwardcarmack/gearforce-web | |
jobs: | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
build: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
outputs: | |
IMAGE_TAGS: ${{ steps.gather-variables.outputs.IMAGE_TAGS }} | |
SHA: ${{ steps.gather-variables.outputs.SHA }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Gather variables" | |
id: gather-variables | |
run: | | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=latest | |
SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
echo "SHA=$SHA" >> "$GITHUB_OUTPUT" | |
IMAGE_TAGS="$IMAGE_NAME:$VERSION,$IMAGE_NAME:$SHA" | |
echo "IMAGE_TAGS=$IMAGE_TAGS" >> "$GITHUB_OUTPUT" | |
# Set up Flutter. | |
- name: Clone Flutter repository with stable channel | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- run: flutter doctor -v | |
# Checkout code and get packages. | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- run: flutter pub get | |
# Analyze, check formatting, and run unit tests. | |
- run: flutter analyze | |
- name: Ensure the Dart code is formatted correctly | |
run: dart format --set-exit-if-changed . | |
- name: Run Flutter unit tests | |
run: flutter test | |
- name: Build Flutter web | |
run: flutter build web --release | |
- name: "Set up QEMU" | |
uses: docker/setup-qemu-action@v3 | |
- name: "Set up Docker Buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "Log into DockerHub" | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Build and push" | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
target: release | |
tags: ${{ steps.gather-variables.outputs.IMAGE_TAGS }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Kubernetes set context | |
uses: Azure/k8s-set-context@v4 | |
with: | |
method: kubeconfig | |
kubeconfig: ${{ secrets.KUBE_CONFIG }} | |
- name: Deploy latest main to the linode cluster | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: | | |
helm upgrade -n gearforce --install --set image.tag=${{ needs.build.outputs.SHA }} --set replicaCount=2 ${{ secrets.HELM_RELEASE_NAME }} chart/gearforce | |
- name: Deploy to playtest on the linode cluster | |
if: github.event_name == 'push' && github.ref == 'refs/heads/playtest/nj' | |
run: | | |
helm upgrade -n playtest --install --set image.tag=${{ needs.build.outputs.SHA }} --set replicaCount=1 gfpt1 chart/gearforce |