forked from opencrvs/opencrvs-countryconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.73 KB
/
publish-release.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Publish release
on:
workflow_dispatch:
inputs:
branch_name:
description: Branch to build from
default: master
required: true
release_version:
description: Release tag. It will be prepended by your repository name (e.g. v1.5.3 or 20240501)
required: true
jobs:
base:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: '${{ github.event.inputs.branch_name }}'
- name: Install jq
run: sudo apt-get install jq -y
- name: Set TAG environment variable
run: echo "TAG=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV
- uses: trstringer/manual-approval@v1
with:
secret: ${{ github.TOKEN }}
approvers: euanmillar,rikukissa
minimum-approvals: 1
issue-title: 'Release: ${{ env.TAG }}'
issue-body: 'Please approve or deny the publishing of release: ${{ env.TAG }} to Dockerhub'
exclude-workflow-initiator-as-approver: false
- name: Push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ${{ github.event.repository.name }}-
custom_tag: ${{ env.TAG }}
release_branches: ${{ github.event.inputs.branch_name }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image
env:
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }}
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }}
run: |
export COUNTRY_CONFIG_VERSION=${{ env.TAG }}
echo "Publishing a Docker image with a tag $COUNTRY_CONFIG_VERSION"
bash build-and-push.sh && unset COUNTRY_CONFIG_VERSION
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.TAG }}
name: Release ${{ env.TAG }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Merge ${{ github.event.inputs.branch_name }} -> master
uses: devmasx/merge-branch@master
with:
type: now
from_branch: ${{ github.event.inputs.branch_name }}
target_branch: master
message: Merge ${{ github.event.inputs.branch_name }} to master
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge master -> develop
uses: devmasx/merge-branch@master
with:
type: now
from_branch: master
target_branch: develop
message: Merge master back to develop
github_token: ${{ secrets.GITHUB_TOKEN }}