feat: use checked in OCELOT_VERSION
`workflow_dispatch` only works on the default branch which is inconvenient for development
This commit is contained in:
parent
57e7615c25
commit
78e7f7b3b7
34
.github/workflows/publish.yml
vendored
34
.github/workflows/publish.yml
vendored
@ -1,16 +1,6 @@
|
||||
name: publish
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ocelot_version:
|
||||
description: Ocelot build image version
|
||||
required: true
|
||||
type: string
|
||||
deploy:
|
||||
description: Deploy to cluster
|
||||
required: true
|
||||
type: boolean
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
build-and-push-images:
|
||||
@ -42,19 +32,21 @@ jobs:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Read $OCELOT_VERSION from file
|
||||
run: cat .env >> $GITHUB_ENV
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@70b2cdc6480c1a8b86edf1777157f8f437de2166
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=schedule,prefix=ocelot-${{ inputs.ocelot_version }}--branded-
|
||||
type=semver,pattern={{version}},prefix=ocelot-${{ inputs.ocelot_version }}--branded-
|
||||
type=semver,pattern={{major}}.{{minor}},prefix=ocelot-${{ inputs.ocelot_version }}--branded-
|
||||
type=semver,pattern={{major}},prefix=ocelot-${{ inputs.ocelot_version }}--branded-
|
||||
type=ref,event=branch,prefix=ocelot-${{ inputs.ocelot_version }}--branded-
|
||||
type=ref,event=pr,prefix=ocelot-${{ inputs.ocelot_version }}--branded-
|
||||
type=sha,prefix=ocelot-${{ inputs.ocelot_version }}--branded-sha-
|
||||
type=schedule,prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-
|
||||
type=semver,pattern={{version}},prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-
|
||||
type=semver,pattern={{major}}.{{minor}},prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-
|
||||
type=semver,pattern={{major}},prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-
|
||||
type=ref,event=branch,prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-
|
||||
type=ref,event=pr,prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-
|
||||
type=sha,prefix=ocelot-${{ env.OCELOT_VERSION }}--branded-sha-
|
||||
- name: Build and push Docker images
|
||||
id: push
|
||||
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
|
||||
@ -63,13 +55,13 @@ jobs:
|
||||
context: .
|
||||
push: true
|
||||
build-args: |
|
||||
OCELOT_VERSION=${{ inputs.ocelot_version }}
|
||||
OCELOT_VERSION=${{ env.OCELOT_VERSION }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
deploy-to-kubernetes:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ inputs.deploy }}
|
||||
if: ${{ github.ref == 'refs/tags/staging' }}
|
||||
needs: build-and-push-images
|
||||
steps:
|
||||
- uses: mdgreenwald/mozilla-sops-action@d9714e521cbaecdae64a89d2fdd576dd2aa97056 # v1.6.0
|
||||
@ -84,8 +76,6 @@ jobs:
|
||||
sops decrypt ./helmfile/secrets/kubeconfig > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
- uses: helmfile/helmfile-action@80fbb6408b98822310f94d8d1321a2cacf87f78f #v1.9.2
|
||||
env:
|
||||
OCELOT_IMAGE_TAG: ${{ inputs.ocelot_version }}
|
||||
with:
|
||||
helmfile-args: apply
|
||||
helmfile-workdirectory: ./helmfile
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
||||
.env
|
||||
@ -1,5 +1,5 @@
|
||||
{{ $branded_image_tag:= env "BRANDED_IMAGE_TAG" | default (exec "../scripts/image_tag.sh" (list) | trim) }}
|
||||
{{ $ocelot_image_tag := env "OCELOT_IMAGE_TAG" | default "master" }}
|
||||
{{ $branded_image_tag:= env "BRANDED_IMAGE_TAG" | default (exec "../scripts/branded_image_tag.sh" (list) | trim) }}
|
||||
{{ $ocelot_image_tag := env "OCELOT_IMAGE_TAG" | default (exec "../scripts/ocelot_image_tag.sh" (list) | trim) }}
|
||||
|
||||
domain: staging.ocelot-social.roschaefer.de
|
||||
namespace: ocelot-staging
|
||||
|
||||
6
helmfile/scripts/ocelot_image_tag.sh
Executable file
6
helmfile/scripts/ocelot_image_tag.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
SCRIPT_PATH=$(realpath $0)
|
||||
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
||||
|
||||
set -a; . ${SCRIPT_DIR}/../../.env; set +a;
|
||||
echo $OCELOT_VERSION
|
||||
Loading…
x
Reference in New Issue
Block a user