name: Publish ARC 2 on: workflow_dispatch: inputs: ref: description: 'The branch, tag or SHA to cut a release from' required: false type: string default: '' release_tag_name: description: 'The name to tag the controller image with' required: true type: string default: 'canary' push_to_registries: description: 'Push images to registries' required: true type: boolean default: false publish_actions_runner_controller_2_chart: description: 'Publish new helm chart for actions-runner-controller-2' required: true type: boolean default: false publish_auto_scaling_runner_set_chart: description: 'Publish new helm chart for auto-scaling-runner-set' required: true type: boolean default: false env: HELM_VERSION: v3.8.0 permissions: packages: write jobs: build-push-image: name: Build and push controller image runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: # If inputs.ref is empty, it'll resolve to the default branch ref: ${{ inputs.ref }} - name: Resolve parameters id: resolve_parameters run: | resolvedRef="${{ inputs.ref }}" if [ -z "$resolvedRef" ] then resolvedRef="${{ github.ref }}" fi echo "resolved_ref=$resolvedRef" >> $GITHUB_OUTPUT echo "INFO: Resolving short SHA for $resolvedRef" echo "short_sha=$(git rev-parse --short $resolvedRef)" >> $GITHUB_OUTPUT echo "INFO: Normalizing repository name (lowercase)" echo "repository_owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: # Pinning v0.9.1 for Buildx and BuildKit v0.10.6 # BuildKit v0.11 which has a bug causing intermittent # failures pushing images to GHCR version: v0.9.1 driver-opts: image=moby/buildkit:v0.10.6 - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build & push controller image uses: docker/build-push-action@v3 with: file: Dockerfile platforms: linux/amd64,linux/arm64 build-args: VERSION=${{ inputs.release_tag_name }} push: ${{ inputs.push_to_registries }} tags: | ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-2:${{ inputs.release_tag_name }} ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-2:${{ inputs.release_tag_name }}-${{ steps.resolve_parameters.outputs.short_sha }} cache-from: type=gha cache-to: type=gha,mode=max - name: Job summary run: | echo "The [publish-arc2](https://github.com/actions/actions-runner-controller/blob/main/.github/workflows/publish-arc2.yaml) workflow run was completed successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY echo "- Ref: ${{ steps.resolve_parameters.outputs.resolvedRef }}" >> $GITHUB_STEP_SUMMARY echo "- Short SHA: ${{ steps.resolve_parameters.outputs.short_sha }}" >> $GITHUB_STEP_SUMMARY echo "- Release tag: ${{ inputs.release_tag_name }}" >> $GITHUB_STEP_SUMMARY echo "- Push to registries: ${{ inputs.push_to_registries }}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY publish-helm-chart-arc-2: if: ${{ inputs.publish_actions_runner_controller_2_chart == true }} needs: build-push-image name: Publish Helm chart for actions-runner-controller-2 runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: # If inputs.ref is empty, it'll resolve to the default branch ref: ${{ inputs.ref }} - name: Resolve parameters id: resolve_parameters run: | resolvedRef="${{ inputs.ref }}" if [ -z "$resolvedRef" ] then resolvedRef="${{ github.ref }}" fi echo "INFO: Resolving short SHA for $resolvedRef" echo "short_sha=$(git rev-parse --short $resolvedRef)" >> $GITHUB_OUTPUT echo "INFO: Normalizing repository name (lowercase)" echo "repository_owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - name: Set up Helm uses: azure/setup-helm@v3.3 with: version: ${{ env.HELM_VERSION }} - name: Publish new helm chart for actions-runner-controller-2 run: | echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG=$(cat charts/actions-runner-controller-2/Chart.yaml | grep version: | cut -d " " -f 2) echo "ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG=${ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG}" >> $GITHUB_ENV helm package charts/actions-runner-controller-2/ --version="${ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG}" helm push actions-runner-controller-2-"${ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-charts - name: Job summary run: | echo "New helm chart for actions-runner-controller-2 published successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY echo "- Ref: ${{ steps.resolve_parameters.outputs.resolvedRef }}" >> $GITHUB_STEP_SUMMARY echo "- Short SHA: ${{ steps.resolve_parameters.outputs.short_sha }}" >> $GITHUB_STEP_SUMMARY echo "- Actions-Runner-Controller-2 Chart version: ${{ env.ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY publish-helm-chart-auto-scaling-runner-set: if: ${{ inputs.publish_auto_scaling_runner_set_chart == true }} needs: build-push-image name: Publish Helm chart for auto-scaling-runner-set runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: # If inputs.ref is empty, it'll resolve to the default branch ref: ${{ inputs.ref }} - name: Resolve parameters id: resolve_parameters run: | resolvedRef="${{ inputs.ref }}" if [ -z "$resolvedRef" ] then resolvedRef="${{ github.ref }}" fi echo "INFO: Resolving short SHA for $resolvedRef" echo "short_sha=$(git rev-parse --short $resolvedRef)" >> $GITHUB_OUTPUT echo "INFO: Normalizing repository name (lowercase)" echo "repository_owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT - name: Set up Helm uses: azure/setup-helm@v3.3 with: version: ${{ env.HELM_VERSION }} - name: Publish new helm chart for auto-scaling-runner-set run: | echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG=$(cat charts/auto-scaling-runner-set/Chart.yaml | grep version: | cut -d " " -f 2) echo "AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG=${AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG}" >> $GITHUB_ENV helm package charts/auto-scaling-runner-set/ --version="${AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG}" helm push auto-scaling-runner-set-"${AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-charts - name: Job summary run: | echo "New helm chart for auto-scaling-runner-set published successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY echo "- Ref: ${{ steps.resolve_parameters.outputs.resolvedRef }}" >> $GITHUB_STEP_SUMMARY echo "- Short SHA: ${{ steps.resolve_parameters.outputs.short_sha }}" >> $GITHUB_STEP_SUMMARY echo "- Auto-Scaling-Runner-Set Chart version: ${{ env.AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY