Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use commit hash to tag container images #472

Merged
merged 1 commit into from
Feb 12, 2025
Merged
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
25 changes: 8 additions & 17 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 @@ -21,6 +19,8 @@ jobs:
uses: crazy-max/ghaction-docker-meta@v4.0.1
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2.2.0
Expand Down Expand Up @@ -55,32 +55,23 @@ 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@v3.3.0
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@v3.3.0
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"
Expand All @@ -90,14 +81,14 @@ jobs:
sed -i "/image:/{n;s/tag:.*/tag: $TAG/;}" ./repos/wbaas-deploy-production/k8s/helmfile/env/production/mediawiki-139.values.yaml.gotmpl
-
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)
echo "msg=$MSG" >> $GITHUB_OUTPUT
-
uses: peter-evans/create-pull-request@v4
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 MediaWiki image ${{ steps.update-values.outputs.tag }}'
Expand All @@ -113,7 +104,7 @@ jobs:
**Changes**: [${{ steps.truncate-commit-message.outputs.msg }}](https://github.com/wbstack/mediawiki/commit/${{ github.sha }})
-
uses: peter-evans/create-pull-request@v4
if: steps.update-check.outputs.match == 'true'
if: github.event_name != 'pull_request'
with:
path: ./repos/wbaas-deploy-production
commit-message: 'Production: Deploy new MediaWiki image ${{ steps.update-values.outputs.tag }}'
Expand Down
Loading