-
Notifications
You must be signed in to change notification settings - Fork 147
101 lines (95 loc) · 3.37 KB
/
create-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
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
name: Create a release
on:
workflow_dispatch:
# push:
# branches:
# - main-enterprise
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
if: ${{ github.actor != 'dependabot'}}
runs-on: ubuntu-latest
outputs:
release: ${{ steps.finalrelease.outputs.release }}
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
- run: npm install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image Locally
uses: docker/build-push-action@master
with:
context: .
file: ./Dockerfile
load: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise
- name: Inspect the Docker Image
run: |
docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise
- name: Run Functional Tests
id: functionaltest
run: |
docker run --env APP_ID=${{ secrets.APP_ID }} --env PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} --env WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }} -d -p 3000:3000 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise
sleep 10
curl http://localhost:3000
- name: Tag a final release
id: finalrelease
uses: actionsdesk/[email protected]
with:
bump: final
- name: Push Docker Image
if: ${{ success() }}
uses: docker/build-push-action@master
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.finalrelease.outputs.release }}
platforms: linux/amd64,linux/arm64
provenance: false
sbom: false
helm:
runs-on: ubuntu-latest
needs: build
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Prepare
run: |
# OCI standard enforces lower-case paths
GHCR_REPO=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
HELM_REPO=$(echo "oci://ghcr.io/${{ github.repository_owner }}/helm-charts" | tr '[:upper:]' '[:lower:]')
echo "GHCR_REPO=$GHCR_REPO" >> $GITHUB_ENV
echo "HELM_REPO=$HELM_REPO" >> $GITHUB_ENV
- name: Publish Helm charts
run: |
cd helm
helm registry login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
helm package --app-version ${{ needs.build.outputs.release }} --version ${{ needs.build.outputs.release }} safe-settings
helm push safe-settings-${{ needs.build.outputs.release }}.tgz ${{ env.HELM_REPO }}
#trigger-deployment:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: decyjphr-actions/[email protected]
# with:
# workflow: deploy-k8s.yml
# token: ${{ secrets.pat }}
# ref: ${{ github.event.pull_request.head.ref || github.ref }}
# inputs: '{"release": "${{needs.build.outputs.release}}", "status": "passed" }'