Merge pull request #474 from sivertschou/discord-webhooks-fix #157
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: Build and deploy | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build, tag and push image | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.gitversion.outputs.semVer }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v3 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build, tag and push backend | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./apps/backend/Dockerfile | |
tags: ${{ vars.DOCKERHUB_USERNAME }}/dundring-backend:${{ steps.gitversion.outputs.semVer }} | |
push: true | |
- name: Build, tag and push frontend | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./apps/frontend/Dockerfile | |
push: true | |
tags: ${{ vars.DOCKERHUB_USERNAME }}/dundring-frontend:${{ steps.gitversion.outputs.semVer }} | |
- name: Set version tag | |
run: | | |
git tag ${{ steps.gitversion.outputs.semVer }} | |
git push origin ${{ steps.gitversion.outputs.semVer }} | |
- name: Generate changelog | |
id: changelog | |
uses: requarks/changelog-action@v1 | |
with: | |
token: ${{ github.token }} | |
tag: ${{ steps.gitversion.outputs.semVer }} | |
excludeTypes: '' | |
- name: Create release | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ steps.gitversion.outputs.semVer }} | |
token: ${{ github.token }} | |
name: ${{ steps.gitversion.outputs.semVer }} | |
body: ${{ steps.changelog.outputs.changes }} | |
draft: false | |
prerelease: false | |
deploy-dev: | |
name: Deploy dev | |
environment: | |
name: dev | |
url: https://dev.dundring.com | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Deploy | |
uses: ./.github/actions/deploy | |
with: | |
version: ${{ needs.build.outputs.version }} | |
base_url: '${{ vars.BASE_URL }}' | |
cloudflare_api_key: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
database_password: ${{ secrets.DATABASE_PASSWORD }} | |
database_url: ${{ secrets.DATABASE_URL }} | |
mail_host: ${{ secrets.MAIL_HOST }} | |
mail_password: ${{ secrets.MAIL_PASSWORD }} | |
mail_port: ${{ secrets.MAIL_PORT }} | |
mail_user: ${{ secrets.MAIL_USER }} | |
redis_url: ${{ secrets.REDIS_URL }} | |
ssh_host: ${{ secrets.SSH_HOST }} | |
ssh_key: ${{ secrets.SSH_KEY }} | |
ssh_username: ${{ secrets.SSH_USERNAME }} | |
strava_client_id: ${{ secrets.STRAVA_CLIENT_ID }} | |
strava_client_secret: ${{ secrets.STRAVA_CLIENT_SECRET }} | |
token_secret: ${{ secrets.TOKEN_SECRET }} | |
deploy-prod: | |
name: Deploy prod | |
environment: | |
name: prod | |
url: https://dundring.com | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Deploy | |
uses: ./.github/actions/deploy | |
with: | |
version: ${{ needs.build.outputs.version }} | |
base_url: '${{ vars.BASE_URL }}' | |
cloudflare_api_key: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
database_password: ${{ secrets.DATABASE_PASSWORD }} | |
database_url: ${{ secrets.DATABASE_URL }} | |
discord_webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
mail_host: ${{ secrets.MAIL_HOST }} | |
mail_password: ${{ secrets.MAIL_PASSWORD }} | |
mail_port: ${{ secrets.MAIL_PORT }} | |
mail_user: ${{ secrets.MAIL_USER }} | |
redis_url: ${{ secrets.REDIS_URL }} | |
ssh_host: ${{ secrets.SSH_HOST }} | |
ssh_key: ${{ secrets.SSH_KEY }} | |
ssh_username: ${{ secrets.SSH_USERNAME }} | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
strava_client_id: ${{ secrets.STRAVA_CLIENT_ID }} | |
strava_client_secret: ${{ secrets.STRAVA_CLIENT_SECRET }} | |
token_secret: ${{ secrets.TOKEN_SECRET }} |