CD #289
This file contains hidden or 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: CD | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push on the master branch | |
| push: | |
| branches: | |
| - master | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| # Remove all permissions by default | |
| permissions: {} | |
| env: | |
| BASENAME: bitnami/minideb | |
| LATEST: trixie | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| shellcheck: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-24.04 | |
| if: github.event_name != 'schedule' || github.repository == 'bitnami/minideb' | |
| name: Shellcheck | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt-get install -y shellcheck | |
| - name: Verify scripts with shellcheck | |
| run: | | |
| bash shellcheck | |
| build_multiarch: | |
| runs-on: ${{ matrix.arch.platform }} | |
| needs: [ shellcheck ] | |
| strategy: | |
| matrix: | |
| dist: [bullseye, bookworm, trixie] | |
| arch: | |
| - { name: amd64, platform: ubuntu-24.04 } | |
| - { name: arm64, platform: ubuntu-24.04-arm } | |
| name: Build ${{ matrix.dist }} on ${{ matrix.arch.name }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 | |
| - name: Use local build action | |
| id: build | |
| uses: ./.github/actions/build | |
| with: | |
| dist: "${{ matrix.dist }}" | |
| platform: "${{ matrix.arch.name }}" | |
| is_latest: ${{ matrix.dist == env.LATEST }} | |
| - name: Push to DockerHUB | |
| if: github.repository == 'bitnami/minideb' && github.ref == 'refs/heads/master' | |
| env: | |
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
| DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
| DOCKER_REGISTRY: docker.io | |
| DOCKER_CONTENT_TRUST_REPOSITORY_KEY: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_KEY }} | |
| DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }} | |
| run: | | |
| bash pushone "${{ matrix.dist }}" "${{ matrix.arch.name }}" | |
| if ${{ matrix.dist == env.LATEST }} ; then | |
| bash pushone "latest" "${{ matrix.arch.name }}" | |
| fi | |
| - name: Push to AWS | |
| if: github.repository == 'bitnami/minideb' && github.ref == 'refs/heads/master' | |
| env: | |
| DOCKER_USERNAME: AWS | |
| DOCKER_REGISTRY: public.ecr.aws | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PUBLIC_GALLERY_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PUBLIC_GALLERY_SECRET_KEY }} | |
| run: | | |
| # AWS login | |
| export DOCKER_PASSWORD="$(aws ecr-public get-login-password --region us-east-1)" | |
| bash pushone "${{ matrix.dist }}" "${{ matrix.arch.name }}" | |
| if ${{ matrix.dist == env.LATEST }} ; then | |
| bash pushone "latest" "${{ matrix.arch.name }}" | |
| fi | |
| deploy_manifests: | |
| runs-on: ubuntu-24.04 | |
| needs: [ build_multiarch ] | |
| if: github.repository == 'bitnami/minideb' && github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 | |
| - name: Push Manifests to DockerHUB | |
| env: | |
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
| DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
| DOCKER_REGISTRY: docker.io | |
| run: | | |
| DISTS="bullseye bookworm trixie latest" bash pushmanifest | |
| - name: Push Manifests to AWS | |
| env: | |
| DOCKER_USERNAME: AWS | |
| DOCKER_REGISTRY: public.ecr.aws | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PUBLIC_GALLERY_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PUBLIC_GALLERY_SECRET_KEY }} | |
| run: | | |
| # AWS login | |
| export DOCKER_PASSWORD="$(aws ecr-public get-login-password --region us-east-1)" | |
| DISTS="bullseye bookworm trixie latest" bash pushmanifest | |
| # If the CI Pipeline does not succeed we should notify the interested agents | |
| notify: | |
| name: Send notification | |
| needs: | |
| - build_multiarch | |
| - deploy_manifests | |
| if: ${{ always() && github.repository == 'bitnami/minideb' && (needs.build_multiarch.result == 'failure' || needs.deploy_manifests.result == 'failure') }} | |
| uses: bitnami/support/.github/workflows/gchat-notification.yml@main | |
| with: | |
| workflow: ${{ github.workflow }} | |
| job-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| secrets: | |
| webhook-url: ${{ secrets.GCHAT_CONTENT_ALERTS_WEBHOOK_URL }} |