-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (95 loc) · 4.09 KB
/
Copy pathrelease-please.yaml
File metadata and controls
110 lines (95 loc) · 4.09 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
name: Release Please
on:
push:
branches:
- develop
permissions:
actions: read
contents: write
issues: write
pull-requests: write
id-token: write
env:
MISE_PYTHON_COMPILE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
cli-release-created: ${{ steps.release.outputs['release_created'] }}
server-release-created: ${{ steps.release.outputs['release_created'] }}
helm-release-created: ${{ steps.release.outputs['charts/gitops--release_created'] }}
server-version: ${{ steps.release.outputs['tag_name'] }}
helm-version: ${{ steps.release.outputs['charts/gitops--tag_name'] }}
sha: ${{ steps.release.outputs.sha }}
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # ratchet:googleapis/release-please-action@v4
id: release
with: {}
publish_helm_chart:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.helm-version }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # ratchet:actions/checkout@v6.0.1
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@89c6698c192e70ed0e495bee7d3d1ca5b477fe82 # ratchet:stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
publish_to_pypi:
name: Publishes tag to pypi
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.cli-release-created }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # ratchet:actions/checkout@v6.0.1
- uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # ratchet:jdx/mise-action@v3.5.1
with:
install: true
cache: true
experimental: true
- run: mise run build
shell: bash
- name: Publish Pypi Package
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # ratchet:pypa/gh-action-pypi-publish@release/v1
publish_docker_image:
name: Build and Push Docker Image
runs-on: ubuntu-24.04
needs: release-please
if: ${{ needs.release-please.outputs.server-release-created }}
steps:
- name: Checkout Code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # ratchet:actions/checkout@v6.0.1
with:
fetch-depth: 2
- name: Set environment variables
run: |
echo "GIT_SHORT_HASH=$(echo ${{ github.sha }} | cut -c -7)" >> $GITHUB_ENV
- name: Decode cluster key
env:
SECRET_ENV: ${{ secrets.CLUSTER_KEY }}
run: echo $SECRET_ENV | base64 -d > cluster.key
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # ratchet:aws-actions/configure-aws-credentials@v5.1.1
with:
role-to-assume: arn:aws:iam::610829907584:role/default-github-actions-ci-role
role-session-name: ${{ github.repository_owner }}-${{ github.event.repository.name }}
aws-region: ap-southeast-2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # ratchet:docker/setup-buildx-action@v3.12.0
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # ratchet:aws-actions/amazon-ecr-login@v2
- name: Build and push image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # ratchet:docker/build-push-action@v6
with:
context: "."
file: Dockerfile
cache-from: type=gha
cache-to: type=gha, mode=max
provenance: false
platforms: linux/amd64,linux/arm64
push: true
tags: |
610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/gitops:${{ env.GIT_SHORT_HASH }}
610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/gitops:latest
610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/gitops:${{ needs.release-please.outputs.server-version }}