-
-
Notifications
You must be signed in to change notification settings - Fork 5
128 lines (120 loc) · 4.74 KB
/
release-qa.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Releases from master branch to QA staging server.
name: "Release to QA"
concurrency: deploy-staging
on:
schedule:
# Run every day except Tuesday, at 01:30 UTC, shortly before beginning of tester workday.
# Note that this workflow can be disabled from the GitHub UI by going to
# Actions > Workflows > Release to QA > "..." > Disable workflow
- cron: "30 1 * * 0-1,3-6"
workflow_dispatch:
inputs:
skip-branch-update:
description: "Skip updating the release branch, and just release the tip of the branch as it currently exists. This can be used to release a hotfix, provided you've already pushed it to the release branch."
required: true
type: boolean
default: false
re-release:
description: "Build and release even if the build commit already has a release tag."
required: true
type: boolean
default: false
jobs:
determine_build_commit:
name: "Determine commit from which to build"
runs-on: ubuntu-22.04
outputs:
build_commit: "${{ steps.get_commit.outputs.build_commit }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Use latest branch master
if: ${{ github.event.inputs.skip-branch-update == 'false' }}
run: git checkout master
- name: Use existing branch sf-qa
if: ${{ github.event.inputs.skip-branch-update == 'true' }}
run: git checkout sf-qa
- name: Get commit
id: get_commit
run: |
set -xueo pipefail
build_commit="$(git rev-parse HEAD)"
echo "build_commit=${build_commit}" >> $GITHUB_OUTPUT
- name: Details on selected build commit
run: |
set -u
build_commit="${{ steps.get_commit.outputs.build_commit }}"
echo "Using build_commit: ${build_commit}"
echo " "
echo "git describe: $(git describe "${build_commit}")"
echo " "
echo "Commit details:"
git show --stat "${build_commit}"
echo " "
echo "Commit and ancestors:"
git log --graph --decorate=short --oneline --abbrev=9 --max-count 5 "${build_commit}"
echo " "
echo "Commit in context of other branches:"
build_commit_abbrev="${build_commit:0:9}"
git log --graph --decorate=short --oneline --abbrev=9 --max-count 100 origin/sf-live origin/sf-qa origin/master | grep "${build_commit_abbrev}" --context=7 | perl -p -e "s/${build_commit_abbrev}/${build_commit_abbrev} <--/"
stop_if_already_built:
# Do not build again if the commit has already been built from and tagged.
name: "Stop if already built"
needs: determine_build_commit
outputs:
already_built: "${{ steps.check_if_already_built.outputs.already_built }}"
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ needs.determine_build_commit.outputs.build_commit }}
fetch-depth: "0"
- name: Check if already built
id: check_if_already_built
run: |
set -xueo pipefail
TAGS=$(git tag --points-at "${{ needs.determine_build_commit.outputs.build_commit }}")
PATTERN='^SF-QAv[0-9.]+$'
# Does the current commit have any tags like this?
MATCH=false
for TAG in $TAGS; do
if [[ $TAG =~ $PATTERN ]]; then
MATCH=true
break
fi
done
echo "already_built=${MATCH}" >> $GITHUB_OUTPUT
determine_version:
name: "Determine version"
needs: [determine_build_commit, stop_if_already_built]
if: ${{ needs.stop_if_already_built.outputs.already_built == 'false' || github.event.inputs.re-release == 'true' }}
uses: ./.github/workflows/compute-next-version.yml
with:
versioning-system: "staging"
tag_prefix: "SF-QAv"
release_branch: "sf-qa"
deploy:
name: "Deploy to QA"
needs: [determine_build_commit, determine_version]
secrets: inherit
uses: ./.github/workflows/release.yml
with:
environment: "qa_deploy"
build_commit: ${{ needs.determine_build_commit.outputs.build_commit }}
release_branch: "sf-qa"
dotnet_version: "8.0.x"
node_version: "22.13.0"
npm_version: "10.9.2"
# When bumping OS version, the server will need to authorize the new default rsync args.
os: "ubuntu-22.04"
angular_config: "staging"
app_name: "scriptureforge"
app_suffix: "_qa"
version_number: "${{ needs.determine_version.outputs.next_version }}"
vcs_tag_prefix: "SF-QAv"
node_options: "--max_old_space_size=4096"
project: "SIL.XForge.Scripture"
server_domain_name: "qa.scriptureforge.org"