chore: Update deps #21
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: highscore_cleanup_job | |
on: | |
push: | |
branches: [main] | |
paths: | |
- highscore-cleanup-job/** | |
- .github/workflows/highscore_cleanup_job.yaml | |
pull_request: | |
branches: [main] | |
paths: | |
- highscore-cleanup-job/** | |
- .github/workflows/highscore_cleanup_job.yaml | |
permissions: | |
# required for federated credentials to access azure | |
id-token: write | |
# required for federated credentials to access azure | |
contents: read | |
# required to push to ghcr | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare docker compose file(s) | |
run: | | |
printf 'Deleting docker-compose.override.yml (it is only used during development)\n' | |
rm docker-compose.override.yml | |
printf "Adding commit sha as build tag\n" | |
COMMIT_SHA="$(git rev-parse --short HEAD)" yq -i \ | |
'.services.cleanup-job.build.tags[0] = "ghcr.io/christianfosli/snake/highscore-cleanup-job:" + strenv(COMMIT_SHA)' docker-compose.yml | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
printf 'Banch is main! Adding latest as build tag\n' | |
yq -i '.services.cleanup-job.build.tags[1] = "ghcr.io/christianfosli/snake/highscore-cleanup-job:latest"' docker-compose.yml | |
fi | |
printf '\n\n' | |
yq '.services.cleanup-job' docker-compose.yml | |
- name: Build with docker compose | |
run: docker compose build cleanup-job | |
env: | |
DOCKER_BUILDKIT: 1 | |
- name: Login to ghcr | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push | |
run: docker push --all-tags ghcr.io/christianfosli/snake/highscore-cleanup-job | |
deploy_staging: | |
needs: build | |
runs-on: ubuntu-22.04 | |
environment: staging | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: azure/login@v1 | |
with: | |
client-id: ${{ vars.AZ_CLIENT_ID }} | |
subscription-id: ${{ vars.AZ_SUBSCRIPTION_ID }} | |
tenant-id: ${{ vars.AZ_TENANT_ID }} | |
- run: az extension add -n containerapp | |
- run: | | |
az containerapp job update -n caj-snakehighscoreclean-staging -g rg-snake-staging \ | |
--image "ghcr.io/christianfosli/snake/highscore-cleanup-job:$(git rev-parse --short HEAD)" | |
deploy_prod: | |
if: github.event_name != 'pull_request' | |
needs: deploy_staging | |
runs-on: ubuntu-22.04 | |
environment: prod | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: azure/login@v1 | |
with: | |
client-id: ${{ vars.AZ_CLIENT_ID }} | |
subscription-id: ${{ vars.AZ_SUBSCRIPTION_ID }} | |
tenant-id: ${{ vars.AZ_TENANT_ID }} | |
- run: az extension add -n containerapp | |
- run: | | |
az containerapp job update -n caj-snakehighscoreclean-prod -g rg-snake-prod \ | |
--image "ghcr.io/christianfosli/snake/highscore-cleanup-job:$(git rev-parse --short HEAD)" |