[wip] Helm install smoke test #72
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: Docker | |
on: | |
push: | |
branches: [ main ] | |
tags: [ "v*" ] | |
pull_request: | |
branches: [ main ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup version info - main | |
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | |
run: echo "VERSION=$(date +%Y%m%d-%H%M%S)-g$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Setup version info - tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and Push PR - Ephemeral | |
uses: docker/build-push-action@v5 | |
if: github.event_name == 'pull_request' | |
with: | |
context: . | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
ttl.sh/spoopy-operator-pr-${{ github.event.pull_request.number }}:24h | |
- uses: mshick/add-pr-comment@v2 | |
if: (github.event_name == 'pull_request') && ${{ success() }} | |
with: | |
message: | | |
This PR now has an image available for testing: | |
``` | |
ttl.sh/spoopy-operator-pr-${{ github.event.pull_request.number }}:24h | |
``` | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/main' | |
with: | |
context: . | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
ghcr.io/spinkube/spin-operator:${{ env.VERSION }} |