Skip to content

Update dependency vapor/vapor to from: "4.81.1" #1233

Update dependency vapor/vapor to from: "4.81.1"

Update dependency vapor/vapor to from: "4.81.1" #1233

Workflow file for this run

name: Deploy
on:
push:
branches: [master]
workflow_dispatch:
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
REGISTRY_NAME: swiftfiddle.azurecr.io
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
CLUSTER_NAME: swiftfiddle
RESOURCE_GROUP: swiftfiddle
SERVICE_NAME: web-frontend
FONTAWESOME_TOKEN: ${{ secrets.FONTAWESOME_TOKEN }}
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Update Package.swift.json
run: |
set -ex
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git pull --rebase origin master
tempdir=$(mktemp -d)
filename="Package.swift"
curl -sfL -o "$tempdir/$filename" https://raw.github.com/swiftfiddle/swiftfiddle-lsp/main/Resources/ProjectTemplate/$filename
sed -i 's/swift-tools-version:5.5/swift-tools-version:5.4/g' "$tempdir/Package.swift"
swift package --package-path "$tempdir" dump-package > Resources/$filename.json
git add Resources/$filename.json
git diff-index --quiet HEAD || git commit -m "Update $filename.json"
git push origin master
- uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- uses: azure/docker-login@v1
with:
login-server: ${{ env.REGISTRY_NAME }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Build and Push Docker Images
run: |
set -ex
IMAGE_TAG=${{ env.REGISTRY_NAME }}/${{ env.RESOURCE_GROUP }}/${{ env.SERVICE_NAME }}:latest
docker build --build-arg FONTAWESOME_TOKEN=${{ env.FONTAWESOME_TOKEN }} --rm --tag ${IMAGE_TAG} .
docker push ${IMAGE_TAG}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: azure/setup-kubectl@v3
- uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v3
with:
resource-group: ${{ env.RESOURCE_GROUP }}
cluster-name: ${{ env.CLUSTER_NAME }}
- name: Deploy
run: |
set -ex
sed "s/%COMMIT_SHA%/${{ github.sha }}/g;" "k8s/pod_template.yaml" | kubectl apply -f -
kubectl rollout status deployment/${{ env.SERVICE_NAME }}
kubectl get services -o wide