-
Notifications
You must be signed in to change notification settings - Fork 71
57 lines (56 loc) · 2.67 KB
/
patch-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
on:
repository_dispatch:
types: [patch-release]
jobs:
patch-release:
runs-on: ubuntu-latest
steps:
- name: Determine release branch
id: branch_step
run: |
branch=release-$(echo ${{ github.event.client_payload.version }} | cut -d '.' -f 1,2).x
echo "Derived release branch: $branch (this branch must already exist for patch releases)"
echo "branch=$branch" >> $GITHUB_OUTPUT
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: ${{ steps.branch_step.outputs.branch }}
- name: Fetch tags
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Validate tag
run: |
git tag v${{ github.event.client_payload.version }}
# We need to do this for at least a few versions so that we don't force
# users to manually fix the CRDs when migrating from v1beta1 to v1.
- name: Modify spinsvc CRD to assist with migration
uses: mikefarah/[email protected]
with:
cmd: yq -i '.spec.preserveUnknownFields = false' deploy/crds/spinnaker.io_spinnakerservices.yaml
- name: Update manifests version
run: |
cat deploy/operator/basic/deployment.yaml | sed "s|image: armory/spinnaker-operator:.*|image: armory/spinnaker-operator:${{ github.event.client_payload.version }}|" | sed "s|imagePullPolicy:.*|imagePullPolicy: IfNotPresent|" > deploy/operator/basic/deployment.yaml.new
mv deploy/operator/basic/deployment.yaml.new deploy/operator/basic/deployment.yaml
cat deploy/operator/cluster/deployment.yaml | sed "s|image: armory/spinnaker-operator:.*|image: armory/spinnaker-operator:${{ github.event.client_payload.version }}|" | sed "s|imagePullPolicy:.*|imagePullPolicy: IfNotPresent|" > deploy/operator/cluster/deployment.yaml.new
mv deploy/operator/cluster/deployment.yaml.new deploy/operator/cluster/deployment.yaml
- name: Archive manifests
run: tar -czvf manifests.tgz deploy/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.client_payload.version }}
release_name: v${{ github.event.client_payload.version }}
draft: false
prerelease: true
- name: Upload manifests
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./manifests.tgz
asset_name: manifests.tgz
asset_content_type: application/zip