-
Notifications
You must be signed in to change notification settings - Fork 298
123 lines (102 loc) · 3.3 KB
/
publish-build.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
name: Publish Release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag"
required: true
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
tag:
name: Tag + Branch
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: azure/setup-kubectl@v3
id: install
- name: Setup helmfile
uses: mamezou-tech/[email protected]
- name: Update manifests
env:
TAG: "${{ github.event.inputs.tag }}"
run: |
sudo apt-get install -y gettext
bash scripts/patch-image-tag.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Release ${{ github.event.inputs.tag }}"
tagging_message: "${{ github.event.inputs.tag }}"
branch: "release/${{ github.event.inputs.tag }}"
create_branch: true
images:
name: Build Images
needs: tag
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tag }}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Build Images
env:
TAG: "${{ github.event.inputs.tag }}"
run: |
# Build first to ensure all images create successfully
scripts/build-image.sh -r 'public.ecr.aws/aws-containers' -t $TAG --multi-arch
- name: Get AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GithubActionsSession
- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Push Images
env:
TAG: "${{ github.event.inputs.tag }}"
run: |
# Push all images
scripts/build-image.sh -r 'public.ecr.aws/aws-containers' -t $TAG --multi-arch -p
release:
name: Release
needs: [tag, images]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tag }}
- name: Merge to main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create -B main -H release/${{ github.event.inputs.tag }} --title 'chore(release): ${{ github.event.inputs.tag }}' --body 'Generate pull request for release'
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
with:
configuration: "release-notes-configuration.json"
toTag: ${{ github.event.inputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.tag }}
name: Release ${{ github.event.inputs.tag }}
body: ${{steps.github_release.outputs.changelog}}