canary #505
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: Publish Canary Image | |
| # This workflow anticipates a repository_dispatch event from the following workflow: | |
| # https://github.com/actions/actions-runner-controller/blob/master/.github/workflows/publish-canary.yaml | |
| on: | |
| repository_dispatch: | |
| types: [canary] | |
| # https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch | |
| # Expects the following JSON payload: | |
| # { | |
| # "client_payload": { | |
| # "sha": "84104de74b8e9e555f530d40d8f33cc9471716f5" | |
| # "push_to_registries": true | |
| # } | |
| # } | |
| # https://docs.github.com/en/rest/overview/permissions-required-for-github-apps | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| TARGET_ORG: actions-runner-controller | |
| TARGET_REPO: actions-runner-controller | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| canary-build: | |
| name: Build and Publish Canary Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Input validation | |
| run: | | |
| if [ -z "${{ github.event.client_payload.push_to_registries }}" ]; then | |
| echo "client_payload.push_to_registries cannot be empty" | |
| exit 1 | |
| fi | |
| if [ -z "${{ github.event.client_payload.sha }}" ]; then | |
| echo "client_payload.sha cannot be empty" | |
| exit 1 | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup Docker Environment | |
| uses: ./.github/actions/setup-docker-environment | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| ghcr_username: ${{ github.actor }} | |
| ghcr_password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: actions/actions-runner-controller | |
| path: arc/ | |
| ref: ${{ github.event.client_payload.sha }} | |
| # Considered unstable builds | |
| # See Issue #285, PR #286, and PR #323 for more information | |
| - name: Build and Push | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: ./arc | |
| file: ./arc/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: VERSION=canary-${{ github.event.client_payload.sha }} | |
| push: ${{ github.event.client_payload.push_to_registries }} | |
| tags: | | |
| ${{ env.DOCKERHUB_USERNAME }}/${{ env.TARGET_REPO }}:canary | |
| ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}:canary | |
| cache-from: type=gha,scope=arc-canary | |
| cache-to: type=gha,mode=max,scope=arc-canary | |