Skip to content

Hotfix: max 0 if you already watched it #11

Hotfix: max 0 if you already watched it

Hotfix: max 0 if you already watched it #11

name: Deploy to Fly
on:
push:
branches: [main]
paths:
- "server/**"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 🎙 Discord notification 1/3
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "Mave-metrics release started ⏳"
- name: 🛑 Cancel previous runs
uses: styfle/[email protected]
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 🔑 Install Fly cli
uses: superfly/flyctl-actions/setup-flyctl@master
- name: 🚀 Build & deploy to Fly
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
working-directory: server
- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Determine new version tag
id: versioning
run: |
LATEST_TAG=$(git tag -l "server-v*" --sort=-v:refname | head -n 1)
echo "LATEST_TAG: $LATEST_TAG"
if [[ "$LATEST_TAG" == "" ]]; then
NEW_TAG="server-v0.1.0"
else
VERSION_NUM=$(echo "$LATEST_TAG" | sed 's/server-v//')
echo "VERSION_NUM: $VERSION_NUM"
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NUM"
echo "Before increment PATCH value is: $PATCH"
PATCH=$((PATCH + 1))
echo "MAJOR: $MAJOR - MINOR: $MINOR - PATCH: $PATCH"
NEW_TAG="server-v${MAJOR}.${MINOR}.${PATCH}"
fi
echo "New tag: $NEW_TAG"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
- name: 🎙 Discord notification 2/3
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "Mave-metrics ${{ steps.release.outputs.new_tag }} has been deployed 🚀"
- name: 🎙 Discord notification 3/3
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
- name: Create and push new tag
run: |
git tag ${{ env.NEW_TAG }}
git push origin ${{ env.NEW_TAG }}