-
Notifications
You must be signed in to change notification settings - Fork 13
159 lines (129 loc) · 5.5 KB
/
Copy pathversioning.yml
File metadata and controls
159 lines (129 loc) · 5.5 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: versioning
on:
push:
branches:
- main
paths-ignore:
- "package.json"
- "CHANGELOG.md"
workflow_dispatch:
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
issues: write
id-token: write
steps:
- name: Setup up node 24
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v2
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
- name: Configure git credentials for semantic-release
run: git config --local url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf "https://github.com/"
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: latest
cache: true
cache-dependency-path: bun.lock
- name: Install Dependencies
run: bun i
- name: Run tests
run: bun run test
- name: Run integration tests
run: bun run test:integration
- name: Install Semantic Release and Plugins
run: bun add -d semantic-release @semantic-release/changelog @semantic-release/exec
- name: Permissions for semantic-release
run: chmod +x ./node_modules/.bin/semantic-release
- name: Run Semantic Release
id: ver
run: bun x semantic-release --debug
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get latest release version
uses: rez0n/actions-github-release@794c12f5e8d629e6ca329cf2e2daeb0f0ce6a3ce # main
id: get_latest_release
with:
token: ${{ steps.app-token.outputs.token }}
repository: "kexa-io/Kexa"
type: "stable"
- name: Print New Latest Version
run: echo ${{ steps.get_latest_release.outputs.release }}
- name: Update package.json version
run: |
# Strip "v" prefix for semver-compliant package.json version
VERSION="${{ steps.get_latest_release.outputs.release }}"
VERSION_NPM="${VERSION#v}"
jq --arg ver "$VERSION_NPM" '.version = $ver' package.json > package.json.tmp
mv package.json.tmp package.json
- name: Update version.ts
run: |
echo 'export const VERSION = "${{ steps.get_latest_release.outputs.release }}";' > Kexa/version.ts
- name: Update CHANGELOG.md
run: |
echo "# Changelog" > CHANGELOG.md.new
echo "" >> CHANGELOG.md.new
echo "## [${{ steps.get_latest_release.outputs.release }}] - $(date +%Y-%m-%d)" >> CHANGELOG.md.new
echo "" >> CHANGELOG.md.new
if [ -f CHANGELOG.md ]; then
tail -n +2 CHANGELOG.md >> CHANGELOG.md.new
fi
mv CHANGELOG.md.new CHANGELOG.md
- name: Remove git credentials before create-pull-request
run: git config --local --unset-all url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf || true
- name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: "chore: update version files to ${{ steps.get_latest_release.outputs.release }} [skip ci]"
title: "chore: update version files to ${{ steps.get_latest_release.outputs.release }} [skip ci]"
body: |
- Version: ${{ steps.get_latest_release.outputs.release }}
- Updated files: package.json, Kexa/version.ts, CHANGELOG.md
- Generated by: ${{ github.workflow }} workflow
- Commit: ${{ github.sha }}
This PR includes `[skip ci]` to prevent retriggering the versioning workflow.
branch: update-version-files-${{ steps.get_latest_release.outputs.release }}
delete-branch: true
add-paths: |
package.json
Kexa/version.ts
CHANGELOG.md
######################################
- name: Login to Docker New Registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ${{ secrets.DOCKER_REGISTRY_NAME}}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME_KEXA }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD_KEXA }}
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Push on Docker Registry
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v6
with:
file: Dockerfile
context: ./
push: true
platforms: linux/arm64,linux/amd64
tags: |
${{ secrets.DOCKER_REGISTRY_NAME}}/kexa/kexa:${{ steps.get_latest_release.outputs.release }}
${{ secrets.DOCKER_REGISTRY_NAME}}/kexa/kexa:latest
cache-from: type=gha
cache-to: type=gha,mode=max