hotfix RELEASE_NOTES #30
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: [ develop, master ] | |
pull_request: | |
branches: [ develop, master ] | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: Restore | |
run: dotnet restore src/Giraffe.Website/Giraffe.Website.fsproj | |
- name: Build | |
run: dotnet build --configuration Release --no-restore src/Giraffe.Website/Giraffe.Website.fsproj | |
deploy: | |
needs: build | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
env: | |
PROJECT: giraffefsharp | |
IMAGE: giraffe-website | |
steps: | |
# Checkout repo | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Build the Docker image | |
- name: Build Docker image | |
run: | | |
PATTERN="refs/tags/v" | |
SUB="" | |
TAG="${GITHUB_REF/$PATTERN/$SUB}" | |
docker build --build-arg version=$TAG -t "$PROJECT"/"$IMAGE":"$TAG" -f src/Giraffe.Website/Dockerfile . | |
# Auth with Docker Hub | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
# Push the Docker image to Docker Hub | |
- name: Publish Docker image | |
run: | | |
PATTERN="refs/tags/v" | |
SUB="" | |
TAG="${GITHUB_REF/$PATTERN/$SUB}" | |
docker push $PROJECT/$IMAGE:$TAG |