forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (63 loc) · 2.16 KB
/
docker-release.yml
File metadata and controls
68 lines (63 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Docker / Tagged builds
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: "The tag to release. Note that this happens by default on the tag push. Only run this action when something went wrong!"
required: false
jobs:
compute-inputs:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.compute.outputs.tag }}
branch: ${{ steps.compute.outputs.branch }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.ref }}
- name: Compute tags and branch
id: compute
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
# Tag push e.g. refs/tags/v16.3.0 => v16.3.0
TAG_REF="${GITHUB_REF#refs/tags/}"
BRANCH_REF="$GITHUB_REF"
elif [[ ${{ github.event_name }} == 'workflow_dispatch' && -n "${{ inputs.tag }}" ]]; then
# Manual dispatch with tag
TAG_REF="${{ inputs.tag }}"
BRANCH_REF="${{ inputs.tag }}"
else
# Fallback to dev
TAG_REF="dev"
BRANCH_REF="dev"
fi
echo "branch=$BRANCH_REF" | tee -a "$GITHUB_OUTPUT"
echo "tag=$TAG_REF" | tee -a "$GITHUB_OUTPUT"
build:
needs: compute-inputs
uses: ./.github/workflows/docker.yml
with:
branch: ${{ needs.compute-inputs.outputs.branch }}
tag: ${{ needs.compute-inputs.outputs.tag }}
secrets: inherit
trigger_helm_release:
if: ${{ github.repository == 'opf/openproject' }}
needs: [compute-inputs, build]
permissions:
contents: none
runs-on: ubuntu-latest
steps:
- name: Trigger Helm charts release
env:
TOKEN: ${{ secrets.OPENPROJECT_CI_TOKEN }}
REPOSITORY: opf/helm-charts
WORKFLOW_ID: core_release.yml
run: |
curl -i --fail-with-body -H"authorization: Bearer $TOKEN" \
-XPOST -H"Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPOSITORY/actions/workflows/$WORKFLOW_ID/dispatches \
-d '{"ref": "main", "inputs": { "tag" : "${{ needs.compute-inputs.outputs.tag }}" }}'