initial attempt at IaC and CI/CD
This commit is contained in:
parent
597c7e4e0b
commit
820b251c61
11 changed files with 355 additions and 1 deletions
70
.github/workflows/app.yml
vendored
Normal file
70
.github/workflows/app.yml
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
name: Deploy App
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- infrastructure/**
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- infrastructure/**
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
IMAGE_NAME: calque-app
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
versionize:
|
||||
name: Versionize
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
semver: ${{ steps.gitversion.outputs.SemVer }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install GitVersion
|
||||
uses: gittools/actions/gitversion/setup@v1.1.1
|
||||
with:
|
||||
versionSpec: "5.x"
|
||||
- name: Determine Version
|
||||
id: gitversion
|
||||
uses: gittools/actions/gitversion/execute@v1.1.1
|
||||
with:
|
||||
useConfigFile: true
|
||||
|
||||
build_and_publish:
|
||||
name: Build & Publish
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
|
||||
runs-on: ubuntu-latest
|
||||
needs: versionize
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build container images
|
||||
working-directory: src
|
||||
run: |
|
||||
docker build . --file Dockerfile --tag ${{ secrets.ACR_LOGIN_SERVER }}/$IMAGE_NAME:${{needs.versionize.outputs.semver}}
|
||||
docker build . --file Dockerfile --tag ${{ secrets.ACR_LOGIN_SERVER }}/$IMAGE_NAME:latest
|
||||
|
||||
- name: Login to ACR
|
||||
uses: azure/docker-login@v2
|
||||
with:
|
||||
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
|
||||
username: ${{ secrets.ACR_USERNAME }}
|
||||
password: ${{ secrets.ACR_PASSWORD }}
|
||||
|
||||
- name: Push container images
|
||||
working-directory: src
|
||||
run: |
|
||||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/$IMAGE_NAME:${{needs.versionize.outputs.semver}}
|
||||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/$IMAGE_NAME:latest
|
Loading…
Add table
Add a link
Reference in a new issue