-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (85 loc) · 2.82 KB
/
application-release.yaml
File metadata and controls
97 lines (85 loc) · 2.82 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
name: Application - Release
on:
workflow_call:
inputs:
application-name:
required: true
type: string
install-dependencies:
type: boolean
default: false
release-version:
type: string
required: true
release-content:
type: string
release-create-branch:
type: boolean
default: true
dockerfile-location:
type: string
default: ./
before-build-command:
type: string
run-name: 'version set to ${{ inputs.release-version }} for release'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 0
- name: Set up JDK Corretto 21
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
architecture: x64
- name: Install NodeJS
if: ${{ inputs.install-dependencies }}
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install Dependencies
if: ${{ inputs.install-dependencies }}
run: |
cd ${{ inputs.dockerfile-location }}
echo "@codbex:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}" > .npmrc
npm install
rm -rf .npmrc
- name: "Configure Git"
run: |
git fetch
git checkout ${{ inputs.branch }}
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Build and Push Docker Image
if: ${{ inputs.before-build-command }}
run: ${{ inputs.before-build-command }}
- name: Build and Push Docker Image
run: |
cd ${{ inputs.dockerfile-location }}
docker buildx create --name codbex-builder
docker buildx use codbex-builder
docker buildx build --tag ${{ inputs.application-name }} -o type=image --platform=linux/arm64,linux/amd64 .
docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker buildx build --push --tag ghcr.io/codbex/${{ inputs.application-name }}:${{ inputs.release-version }} -o type=image --platform=linux/arm64,linux/amd64 .
- name: Git Push Release Branch
if: ${{ inputs.release-create-branch }}
run: |
git checkout -b ${{ inputs.release-version }}
git push --set-upstream origin ${{ inputs.release-version }}
- name: "Create Release"
if: ${{ inputs.release-content }}
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ inputs.release-version }}
name: ${{ inputs.release-version }}
draft: false
prerelease: false
files: |
LICENSE
body: ${{ inputs.release-content }}