forked from vmware-tanzu/community-edition
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (93 loc) · 3.49 KB
/
release-choco-package.yaml
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
name: Release - Choco Package
on:
release:
types:
- released
jobs:
e2e-choco-update:
name: E2E - Choco Upgrade
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'vmware-tanzu/community-edition'
runs-on: windows-latest
steps:
- name: Get Release Branch
id: get_branch
shell: bash
run: |
BUILD_VERSION="${GITHUB_REF/refs\/tags\//}"
BUILD_VERSION_WITHOUT_V="${BUILD_VERSION//"v"}"
MAJOR_MINOR_VERSION="$(echo "${BUILD_VERSION_WITHOUT_V}" | cut -d "." -f1,2)"
RELEASE_BRANCH="release-${MAJOR_MINOR_VERSION}"
echo ::set-output name=RELEASE_BRANCH::${RELEASE_BRANCH}
- name: Check out code
uses: actions/checkout@v1
with:
ref: ${{ steps.get_branch.outputs.RELEASE_BRANCH }}
- name: Test Choco Upgrade
env:
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
ACTUAL_COMMIT_SHA: ${{ github.sha }}
TCE_CI_BUILD: true
shell: powershell
run: |
$env:BUILD_VERSION='${{ steps.get_branch.outputs.RELEASE_BRANCH }}'
cd ./hack/choco
./test/choco-upgrade-test.ps1
$env:BUILD_VERSION=''
update-choco-package:
name: Update Choco Metadata
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'vmware-tanzu/community-edition'
needs:
- e2e-choco-update # required test run before making changes
runs-on: ubuntu-latest
steps:
- name: Config credentials
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_ACCESS_TOKEN }}
run: |
git config --global pull.rebase true
git config --global url."https://git:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code
uses: actions/checkout@v1
- name: Commit Choco Metadata
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_ACCESS_TOKEN }}
ACTUAL_COMMIT_SHA: ${{ github.sha }}
TCE_CI_BUILD: true
shell: bash
run: |
# update-choco-metadata.sh handles which branch we need to update
BUILD_VERSION=${GITHUB_REF/refs\/tags\//} ./hack/choco/update-choco-metadata.sh
publish-choco:
name: Update Choco Package
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'vmware-tanzu/community-edition'
needs:
- e2e-choco-update # required test run before making changes
- update-choco-package # required to make chcoc metadata changes before publish
runs-on: windows-latest
steps:
- name: Get Release Branch
id: get_branch
shell: bash
run: |
BUILD_VERSION="${GITHUB_REF/refs\/tags\//}"
BUILD_VERSION_WITHOUT_V="${BUILD_VERSION//"v"}"
MAJOR_MINOR_VERSION="$(echo "${BUILD_VERSION_WITHOUT_V}" | cut -d "." -f1,2)"
RELEASE_BRANCH="release-${MAJOR_MINOR_VERSION}"
echo ::set-output name=RELEASE_BRANCH::${RELEASE_BRANCH}
- name: Check out code
uses: actions/checkout@v1
with:
ref: ${{ steps.get_branch.outputs.RELEASE_BRANCH }}
- name: Push to Chocolatey
env:
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
ACTUAL_COMMIT_SHA: ${{ github.sha }}
TCE_CI_BUILD: true
shell: powershell
run: |
$env:BUILD_VERSION='${{ steps.get_branch.outputs.RELEASE_BRANCH }}'
./hack/choco/update-choco-package.ps1
$env:BUILD_VERSION=''