-
Notifications
You must be signed in to change notification settings - Fork 81
123 lines (108 loc) · 5.67 KB
/
continue-release-common.yml
File metadata and controls
123 lines (108 loc) · 5.67 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
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
name: Common continue release jobs
on:
workflow_call:
inputs:
release-type:
description: Type of release (production or rc)
required: true
type: string
tag:
description: The release tag to use
required: true
type: string
jobs:
echo-inputs:
runs-on: ubuntu-latest
name: Inputs
steps:
- uses: actions/github-script@v8
env:
RELEASE_TYPE: ${{ inputs.release-type }}
TAG: ${{ inputs.tag }}
with:
script: |
core.summary.addHeading('Workflow inputs', '2');
core.summary.addTable([
['Release Type', `<code>${process.env.RELEASE_TYPE}</code>`],
['Tag', `<code>${process.env.TAG}</code>`]]);
core.summary.write();
check-type:
name: Check release type
runs-on: ubuntu-latest
steps:
- name: Check release type
run: |
if [ "${{ inputs.release-type }}" != rc ] && [ "${{ inputs.release-type }}" != production ]; then
echo "::error::release-type must be either rc or production"
exit 1
fi
continue-release:
name:
Continue ${{ inputs.release-type == 'rc' && 'RC' || 'production
release' }}
needs: check-type
runs-on: ubuntu-latest
environment: ${{ inputs.release-type == 'rc' && 'RC' || 'Production' }}
env:
TAG: ${{ inputs.tag }}
CHANNEL: ${{ inputs.release-type == 'rc' && 'rc' || 'latest' }}
steps:
- name: Download all artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download "$TAG" --dir "$TAG" --repo nordicsemiconductor/pc-nrfconnect-launcher
- name: Update the Windows checksum
env:
GH_TOKEN: ${{ github.token }}
run: |
export NEW_CHECKSUM="$(openssl dgst -sha512 -binary "$TAG"/nrfconnect-setup-*-x64.exe | openssl base64 -A)"
yq '(.files[].sha512, .sha512) = strenv(NEW_CHECKSUM)' -i "$TAG/$CHANNEL.yml"
gh release upload "$TAG" "$TAG/$CHANNEL.yml" --clobber --repo nordicsemiconductor/pc-nrfconnect-launcher
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release edit "$TAG" --draft=false --repo nordicsemiconductor/pc-nrfconnect-launcher
- name: Generate top level yml files
run: |
for yaml_file in */"$CHANNEL"*.yml; do
# Prepend the version to the URL and path
yq '.files[].url |= "${{env.TAG}}/" + . | .path |= "${{env.TAG}}/" + .' "$yaml_file" > "$(basename "$yaml_file")"
done
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: https://files.nordicsemi.com/
JF_ACCESS_TOKEN:
${{ secrets.COM_NORDICSEMI_FILES_PASSWORD_SWTOOLS_FRONTEND
}}
- name: Upload to Artifactory
run: |
# Upload all release files to Artifactory
jf rt upload --flat "$TAG/*" "swtools/external/ncd/launcher/$TAG/"
# Set version property
jf rt sp "swtools/external/ncd/launcher/$TAG/*" "version=$TAG"
# Set platform-specific properties
jf rt sp "swtools/external/ncd/launcher/$TAG/*.AppImage" "main_download=true;platform=linux-x64"
jf rt sp "swtools/external/ncd/launcher/$TAG/nrfconnect-*mac*.zip" "platform=darwin-x64"
jf rt sp "swtools/external/ncd/launcher/$TAG/nrfconnect-*-mac-arm64.zip" "platform=darwin-arm64"
jf rt sp "swtools/external/ncd/launcher/$TAG/nrfconnect-*.dmg" "main_download=true;platform=darwin-x64"
jf rt sp "swtools/external/ncd/launcher/$TAG/nrfconnect-*-arm64.dmg" "main_download=true;platform=darwin-arm64"
jf rt sp "swtools/external/ncd/launcher/$TAG/nrfconnect-setup-*x64.exe" "main_download=true;platform=win32-x64"
# Upload yml files for auto-update
jf rt upload "$CHANNEL*.yml" swtools/external/ncd/launcher/
# Copy the production release also to the RC channel
if [[ "${{ inputs.release-type }}" == "production" ]]; then
jf rt copy 'swtools/external/ncd/launcher/latest(*).yml' 'swtools/external/ncd/launcher/rc{1}.yml'
fi
# Clear cache
jf rt delete --url https://files.nordicsemi.cn/artifactory --access-token "${{ secrets.COM_NORDICSEMI_FILES_PASSWORD_SWTOOLS_FRONTEND }}" "swtools-cache/external/ncd/launcher/$CHANNEL*.yml"
if [[ "${{ inputs.release-type }}" == "production" ]]; then
jf rt delete --url https://files.nordicsemi.cn/artifactory --access-token "${{ secrets.COM_NORDICSEMI_FILES_PASSWORD_SWTOOLS_FRONTEND }}" "swtools-cache/external/ncd/launcher/rc*.yml"
fi
EMOJI=":tada:"
if [[ $(date +%m) -eq 12 ]]; then
EMOJI=":christmas_tree:"
fi
echo "# $EMOJI Successfully created release [$TAG](https://github.com/NordicSemiconductor/pc-nrfconnect-launcher/releases/tag/$TAG) $EMOJI" >> $GITHUB_STEP_SUMMARY