mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
93c030a60d
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v3...v4) --- updated-dependencies: - dependency-name: docker/login-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
157 lines
5.4 KiB
YAML
157 lines
5.4 KiB
YAML
name: "Hocuspocus / Dockerize"
|
|
|
|
on:
|
|
# for continuous integration
|
|
push:
|
|
branches:
|
|
- dev
|
|
- release/*
|
|
paths:
|
|
- 'extensions/op-blocknote-hocuspocus/**'
|
|
- '.github/workflows/hocuspocus-docker.yml'
|
|
# for manually triggered builds
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: "The branch or tag to checkout and build"
|
|
required: true
|
|
type: string
|
|
tag:
|
|
description: "The main docker tag to use (e.g., 'dev' or '16.3.0')"
|
|
required: true
|
|
type: string
|
|
use_test_registry:
|
|
description: "Use openproject/hocuspocus-test registry instead (for testing)"
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
# for use within docker.yml
|
|
workflow_call:
|
|
inputs:
|
|
branch:
|
|
description: "The branch or tag to checkout and build"
|
|
required: true
|
|
type: string
|
|
tag:
|
|
description: "The main docker tag to use (e.g., 'dev' or '16.3.0')"
|
|
required: true
|
|
type: string
|
|
# this option may be passed in from docker.yml if docker.yml was called with it as well
|
|
use_test_registry:
|
|
description: "Use openproject/hocuspocus-test registry instead (for testing)"
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.branch }} # this is empty on push, so it just checks out the event SHA in that case
|
|
- name: Include Git SHA in package.json version
|
|
id: short-sha
|
|
run: |
|
|
SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`
|
|
|
|
# also include Git SHA in version string
|
|
sed -ri "s/\"version\": \"(.*)\"/\"version\": \"\1-$SHORT_SHA\"/g" extensions/op-blocknote-hocuspocus/package.json
|
|
|
|
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
|
|
- name: Determine tags
|
|
id: tags
|
|
run: |
|
|
REGISTRY=openproject/hocuspocus
|
|
|
|
if [ "${{ inputs.use_test_registry }}" = "true" ]; then
|
|
REGISTRY=openproject/hocuspocus-test
|
|
fi
|
|
|
|
BRANCH=$(echo '${{ inputs.branch || github.ref_name }}' | tr / -)
|
|
SPECIFIC_TAG=$BRANCH-${{ steps.short-sha.outputs.short_sha }}
|
|
LATEST_TAG=$BRANCH-latest
|
|
|
|
if [ -n "${{ inputs.tag }}" ]; then
|
|
SPECIFIC_TAG=$(echo '${{ inputs.tag }}' | tr -d v)
|
|
LATEST_TAG=latest
|
|
fi
|
|
|
|
echo 'tags<<EOF' >> $GITHUB_OUTPUT
|
|
echo $REGISTRY:$SPECIFIC_TAG >> $GITHUB_OUTPUT
|
|
echo $REGISTRY:$LATEST_TAG >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Build and push
|
|
id: build
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: extensions/op-blocknote-hocuspocus
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
tags: ${{ steps.tags.outputs.tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Summarize build
|
|
run: |
|
|
echo "Built and pushed the following tags:" >> $GITHUB_STEP_SUMMARY
|
|
echo "${{ steps.tags.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Generate GHA token
|
|
id: generate-gha-token
|
|
uses: actions/create-github-app-token@v2
|
|
with:
|
|
app-id: ${{ vars.DEPLOY_APP_ID }}
|
|
private-key: ${{ secrets.DEPLOY_APP_PRIVATE_KEY }}
|
|
owner: opf
|
|
repositories: saas-deploy
|
|
|
|
- name: Set inputs JSON
|
|
id: build-inputs
|
|
env:
|
|
HOCUSPOCUS_IMAGE: ${{ steps.tags.outputs.tags }}
|
|
THIS_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
run: |
|
|
# get the tag only from the first given image in "org/repository:tag1 org/repository:tag2"
|
|
HOCUSPOCUS_TAG=$(echo $HOCUSPOCUS_IMAGE | cut -d' ' -f1 | cut -d':' -f2)
|
|
|
|
inputs_json=$(jq -cn \
|
|
--arg tag "$HOCUSPOCUS_TAG" \
|
|
--arg url "$THIS_RUN_URL" \
|
|
'{hocuspocus_image_tag: $tag, triggered_by_url: $url}')
|
|
echo "inputs_json=$inputs_json" >> $GITHUB_OUTPUT
|
|
|
|
- name: Deploy EDGE
|
|
if: github.ref == 'refs/heads/dev' && github.repository == 'opf/openproject'
|
|
uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4
|
|
with:
|
|
workflow: edge-deploy-shards.yml
|
|
repo: opf/saas-deploy
|
|
ref: master
|
|
inputs: ${{ steps.build-inputs.outputs.inputs_json }}
|
|
token: "${{ steps.generate-gha-token.outputs.token }}"
|
|
|
|
- name: Deploy STAGE
|
|
# make sure to always use the latest release branch here
|
|
if: github.ref == 'refs/heads/release/17.2' && github.repository == 'opf/openproject'
|
|
uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4
|
|
with:
|
|
workflow: stage-deploy-shards.yml
|
|
repo: opf/saas-deploy
|
|
ref: master
|
|
inputs: ${{ steps.build-inputs.outputs.inputs_json }}
|
|
token: "${{ steps.generate-gha-token.outputs.token }}"
|