Fix path #27
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: 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: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
- name: Import GPG key | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Git configuration | |
run: | | |
git config --global user.email "${{ steps.import-gpg.outputs.email }}" | |
git config --global user.name "${{ steps.import-gpg.outputs.name }}" | |
- 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 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git tag ${{ env.NEW_TAG }} | |
GIT_USER_NAME=$(git config --get user.name) | |
echo "Using GitHub user: $GIT_USER_NAME" | |
git push https://$GIT_USER_NAME:${{ secrets.GITHUB_TOKEN }}@github.com/maveio/metrics.git --tags |