diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7651838..239e057 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,45 +12,18 @@ on: - 'DevCraftAspire.Web/**/*' - '.github/workflows/deploy.yml' -env: - CONTAINER_REGISTRY: "ghcr.io" - BASE_IMAGE: "ghcr.io/lancemccarthy/aspirebase:8.0" - APISERVICE_CONTAINER_REPO: "lancemccarthy/aspireapiservice" - APISERVICE_CONTAINER_TAG: "8.0" - -permissions: - id-token: write - contents: read - packages: write - jobs: - update_base_image: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Login to ghcr.io - uses: docker/login-action@v3 - with: - registry: ${{env.CONTAINER_REGISTRY}} - username: ${{github.actor}} - password: ${{secrets.GITHUB_TOKEN}} - - # Build a custom base image with needed Linux dependencies preinstalled - - name: Build Custom Image and push to GitHub packages - working-directory: '.dockerbuilds/baseimage' - id: build-and-publish - run: | - docker build -t "${{env.BASE_IMAGE}}" -f Dockerfile . - docker push "${{env.BASE_IMAGE}}" - deploy_app: - needs: [update_base_image] runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + packages: write env: + CONTAINER_REGISTRY: "ghcr.io" + BASE_IMAGE: "ghcr.io/lancemccarthy/aspirebase:8.0" + APISERVICE_CONTAINER_REPO: "lancemccarthy/aspireapiservice" + APISERVICE_CONTAINER_TAG: "8.0" ASPIRE_ENVIRONMENT: "aspire2b" AZURE_CLIENT_ID: ${{vars.AZURE_CLIENT_ID}} AZURE_TENANT_ID: ${{vars.AZURE_TENANT_ID}} diff --git a/.github/workflows/monitor-base-images.yml b/.github/workflows/monitor-base-images.yml new file mode 100644 index 0000000..30e1ee4 --- /dev/null +++ b/.github/workflows/monitor-base-images.yml @@ -0,0 +1,20 @@ +name: "Monitor .NET Base Images" +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 0" # Check once a week on Sunday, at midnight + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write # required to trigger repository_dispatch + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: mthalman/docker-bump-action@v0 + with: + base-image-name: 'mcr.microsoft.com/dotnet/aspnet:8.0' + target-image-name: 'ghcr.io/lancemccarthy/aspirebase:8.0' \ No newline at end of file diff --git a/.github/workflows/update-base-images.yml b/.github/workflows/update-base-images.yml new file mode 100644 index 0000000..8eee39b --- /dev/null +++ b/.github/workflows/update-base-images.yml @@ -0,0 +1,43 @@ +name: "Update Custom Base Images" +on: + workflow_dispatch: + repository_dispatch: + types: [base-image-update] + +env: + CONTAINER_REGISTRY: "ghcr.io" + BASE_IMAGE: "ghcr.io/lancemccarthy/aspirebase:8.0" + APP_IMAGE_NAME: lancemccarthy/aspireapiservice + APP_IMAGE_TAG: "8.0" + +permissions: + id-token: write + contents: read + packages: write + +jobs: + ghcr_custom_image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ${{env.CONTAINER_REGISTRY}} + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + + # Build a custom base image with needed Linux dependencies preinstalled + - name: Build Custom Image and push to GitHub packages + working-directory: '.dockerbuilds/baseimage' + id: build-and-publish + run: | + docker build -t "${{env.BASE_IMAGE}}" -f Dockerfile . + docker push "${{env.BASE_IMAGE}}" \ No newline at end of file