Skip to content

[pre-commit.ci] pre-commit autoupdate #364

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #364

Workflow file for this run

name: Test Build Merge Deploy
on:
pull_request:
push:
branches: [main]
jobs:
build-name:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Branch name
run: echo running on branch ${{ github.event.pull_request.head.ref }}
build-primary-container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.SNIDER_TOKEN }}
- name: Set version tags
id: build-prep
run: |
DOCKER_IMAGE=ghcr.io/davidasnider/cava/primary
VERSION=noop
if [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=v1.0.${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Build and push build-primary-container
uses: docker/build-push-action@v2
with:
context: ./src/cava/
file: ./src/cava/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.build-prep.outputs.tags }}
deploy:
runs-on: ubuntu-latest
needs:
- build-name
- build-primary-container
steps:
- name: Set version tags primary container
id: build-prep-primary-container
run: |
DOCKER_IMAGE=ghcr.io/davidasnider/cava/primary
VERSION=noop
if [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION="v1.0.${{ github.event.number }}"
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Check out code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v2
- name: Update kubernetes resources
run: |
# Do base image updates
cd k8s/bases
kustomize edit set image ${{ steps.build-prep-primary-container.outputs.tags }}
cat kustomization.yaml
# Do dev image updates
cd ../dev
kustomize edit set image ${{ steps.build-prep-primary-container.outputs.tags }}
cat kustomization.yaml
# Do prod image updates
cd ../prod
kustomize edit set image ${{ steps.build-prep-primary-container.outputs.tags }}
cat kustomization.yaml
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Bump docker tag"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.CR_PAT }}
branch: ${{ github.event.pull_request.head.ref }}
pr-approve:
runs-on: ubuntu-latest
needs:
- deploy
steps:
- uses: hmarr/auto-approve-action@v3.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
label-pr:
runs-on: ubuntu-latest
needs:
- pr-approve
steps:
- uses: christianvuerings/add-labels@v1.1
with:
labels: |
automerge
env:
GITHUB_TOKEN: ${{ secrets.CR_PAT }}
automerge:
runs-on: ubuntu-latest
needs:
- label-pr
steps:
- name: automerge
uses: "pascalgn/automerge-action@v0.15.5"
env:
GITHUB_TOKEN: "${{ secrets.CR_PAT }}"