Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions .github/workflows/docker.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- 'main'
tags:
- '*'
pull_request:

jobs:
Expand All @@ -19,6 +17,8 @@ jobs:
uses: crazy-max/ghaction-docker-meta@v5.7.0
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down Expand Up @@ -53,37 +53,29 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

- name: Check whether wbaas-deploy should be updated
id: update-check
run: |
if [[ "$GITHUB_REF" =~ ^refs/tags/.+$ ]]; then
echo "This is a tagged release, will try to create an update in wbaas-deploy."
echo "match=true" >> $GITHUB_OUTPUT
fi
- name: Check out `wmde/wbaas-deploy` repository in staging child directory
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
with:
repository: wmde/wbaas-deploy
path: ./repos/wbaas-deploy-staging
- name: Check out `wmde/wbaas-deploy` repository in production child directory
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
with:
repository: wmde/wbaas-deploy
path: ./repos/wbaas-deploy-production
- name: Update values for local, staging and production
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
id: update-values
run: |
TAG="$GITHUB_REF_NAME"
TAG="$(echo ${{ steps.docker_meta.outputs.tags }} | cut -d':' -f2)"
echo "tag=$TAG" >> $GITHUB_OUTPUT
sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-staging/k8s/helmfile/env/local/api.values.yaml.gotmpl
sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-staging/k8s/helmfile/env/staging/api.values.yaml.gotmpl
sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-production/k8s/helmfile/env/production/api.values.yaml.gotmpl
- name: Update argo values for local, staging and production
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
id: update-argo-values
run: |
cd ./repos/wbaas-deploy-staging
Expand All @@ -95,14 +87,14 @@ jobs:
cd ../wbaas-deploy-production
./bin/generate-values production api
- name: Truncate commit message
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
id: truncate-commit-message
run: |
MSG=$(echo "${{ github.event.head_commit.message }}" | head -n 1)
MSG=$(git log -1 --pretty=format:%s)
echo "msg=$MSG" >> $GITHUB_OUTPUT
- name: Create Staging+Local Pull Request
uses: peter-evans/create-pull-request@v7
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
with:
path: ./repos/wbaas-deploy-staging
commit-message: 'Staging+Local: Deploy new Platform API image ${{ steps.update-values.outputs.tag }}'
Expand All @@ -118,7 +110,7 @@ jobs:
**Changes**: [${{ steps.truncate-commit-message.outputs.msg }}](https://github.com/wbstack/api/commit/${{ github.sha }})
- name: Create Production Pull Request
uses: peter-evans/create-pull-request@v7
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
with:
path: ./repos/wbaas-deploy-production
commit-message: 'Production: Deploy new Platform API image ${{ steps.update-values.outputs.tag }}'
Expand Down
Loading
Loading