Skip to content

Create a runnable that polls the api and creates crds using a mock ap… #271

Create a runnable that polls the api and creates crds using a mock ap…

Create a runnable that polls the api and creates crds using a mock ap… #271

Workflow file for this run

name: Docker
on:
push:
branches:
- main
env:
DOCKER_BUILDX_PLATFORMS: linux/amd64,linux/arm64
jobs:
changes:
name: Changes
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
tag: ${{ steps.filter.outputs.tag }}
permissions:
contents: read
pull-requests: read
if: github.repository == 'ngrok/ngrok-operator'
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Check for changes
id: filter
uses: dorny/[email protected]
with:
filters: |
tag:
- 'VERSION'
release:
name: Release Images
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
needs:
- changes
if: |
github.repository == 'ngrok/ngrok-operator' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Extract Version tag
id: extract_tag
run: |
echo "tag=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- id: buildx-setup
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: ${{ env.DOCKER_BUILDX_PLATFORMS }}
- name: Build and push latest docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: ${{ steps.buildx-setup.outputs.platforms }}
push: true
tags: ngrok/ngrok-operator:latest
- name: Build and push tag'd docker image
uses: docker/build-push-action@v3
if: ${{ needs.changes.outputs.tag == 'true' }}
with:
context: .
platforms: ${{ steps.buildx-setup.outputs.platforms }}
push: true
tags: ngrok/ngrok-operator:${{ steps.extract_tag.outputs.tag }}
- name: Create GitHub Release
uses: actions/github-script@v6
if: ${{ needs.changes.outputs.tag == 'true' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const tag = '${{ steps.extract_tag.outputs.tag }}'
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `ngrok-operator-${tag}`,
name: `ngrok-operator-${tag}`,
body: `${tag}`,
draft: false,
prerelease: false
})
console.log(`Release created: ${release.data.html_url}`)