docs: Highlight non-production status (#212) #338
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: Build & publish images | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: [ labeled, unlabeled, opened, synchronize, reopened ] | |
permissions: | |
contents: read | |
packages: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
set-vars: | |
name: Gather job information | |
if: github.repository == 'argoproj-labs/argocd-agent' | |
runs-on: ubuntu-22.04 | |
outputs: | |
image-tag: ${{ steps.image.outputs.tag }} | |
latest: ${{ steps.image.outputs.latest }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set image tag for pushing to ghcr | |
run: | | |
if test "${{ github.event_name }}" = "pull_request"; then | |
echo "tag=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT | |
else | |
echo "tag=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT | |
echo "latest=yes" >> $GITHUB_OUTPUT | |
fi | |
id: image | |
build-and-push: | |
strategy: | |
fail-fast: true | |
matrix: | |
components: | |
- name: agent | |
- name: principal | |
name: Build and push images | |
runs-on: ubuntu-22.04 | |
if: github.repository == 'argoproj-labs/argocd-agent' | |
needs: [set-vars] | |
env: | |
DOCKER_BIN: podman | |
IMAGE_TAG: ${{ needs.set-vars.outputs.image-tag }} | |
IMAGE_LATEST: ${{ needs.set-vars.outputs.latest }} | |
IMAGE_REPOSITORY: ghcr.io/argoproj-labs/argocd-agent | |
IMAGE_NAME: ghcr.io/argoproj-labs/argocd-agent/argocd-agent-${{ matrix.components.name }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Build ${{ matrix.component.name }} image | |
run: | | |
make image-${{ matrix.components.name }} | |
- name: Tag latest | |
if: env.IMAGE_LATEST == 'yes' | |
run: | | |
podman tag ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_NAME }}:latest | |
- name: Push agent image to ghcr.io | |
uses: redhat-actions/push-to-registry@v2 | |
if: github.repository == 'argoproj-labs/argocd-agent' && ( github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ok-to-push') ) | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ghcr.io | |
image: ${{ env.IMAGE_NAME }} | |
tags: ${{ env.IMAGE_TAG }} | |
- name: Push latest tag to ghcr.io | |
uses: redhat-actions/push-to-registry@v2 | |
if: github.repository == 'argoproj-labs/argocd-agent' && ( github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ok-to-push') && env.IMAGE_LATEST == 'yes' ) | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ghcr.io | |
image: ${{ env.IMAGE_NAME }} | |
tags: latest |