-
Notifications
You must be signed in to change notification settings - Fork 40
90 lines (73 loc) · 3.73 KB
/
master.yaml
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
name: Master CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Prepare system path for running python
run: echo "/home/runner/.local/bin" >> $GITHUB_PATH
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
#TODO: change to 1 and then get all tags seperately to see if that's faster. git fetch origin 'refs/tags/*:refs/tags/*'
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
# Create a git tag of the new version to use
# If package.json major and minor versions match last tag, then
# increment last tag. Else use package.json major.minor.0.
- name: Create git tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
KEE_VERSION_MANIFEST=`sed -nE 's/^.*"version": "([0-9]{1,}\\.[0-9]{1,})\\.[0-9x]{1,}"\\,/\\1/p' package.json | tr -d '\\040\\011\\012\\015'`; KEE_VERSION_TAG=`git describe --abbrev=0 --tags | sed -E 's/^([0-9]{1,}\\.[0-9]{1,})\\.([0-9]{1,})$/\\1 \\2/g'`; echo "${KEE_VERSION_MANIFEST} ${KEE_VERSION_TAG}" | awk '{printf($1==$2?""$2"."$3+1:""$1".0")}' | xargs -I {} git tag -a {} -m "{}"
- name: Update package.json based on the git tag we just created
run: |
NEW_KEE_VERSION=`git describe --abbrev=0 --tags`
echo "NEW_KEE_VERSION=$NEW_KEE_VERSION" >> $GITHUB_ENV
sed -E 's/^(.*"version": ")(.*)("\,.*)/\1'"$NEW_KEE_VERSION"'\3/' package.json > package.json.tmp && mv package.json.tmp package.json
- name: Setup
run: |
npm ci
mkdir dist
- name: Build and package beta
run: npm run build:beta && npm run pack:beta
- name: Build and package production
run: npm run build:prod && npm run pack:prod
- name: Build and package Chrome beta
run: npm run build-chrome:beta && npm run pack-chrome:beta
- name: Build and package Chrome production
run: npm run build-chrome:prod && npm run pack-chrome:prod
# We have to do this type check after running the build
# because Vite creates various type definitions we need
- name: Compile Typescript
run: npm run tsc
# Disabled until MV3 rewrite
# - name: Test
# run: npm run test
- name: Lint
run: npm run lint
# - name: Transifex upload
# run: pip install transifex-client && echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = api\ntoken = \npassword = '"$TRANSIFEX_API_TOKEN"$'\n' > .transifexrc && tx -d --traceback push -s;
# env:
# TRANSIFEX_API_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }}
- name: Transifex upload
uses: transifex/cli-action@v2
with:
token: ${{ secrets.TRANSIFEX_API_TOKEN }}
- name: Push git tag
run: git push --tags
- name: Release
uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b
with:
name: ${{ env.NEW_KEE_VERSION }}
tag_name: ${{ env.NEW_KEE_VERSION }}
fail_on_unmatched_files: true
prerelease: true
body: "This is an automatically generated pre-release. Some releases will be thoroughly tested and their derivatives marked as ready for beta and eventually stable release. If the status of this version changes, this message will be replaced. You may want to install the files in this release if you wish to test a specific change that is included within this version. More information can be found at https://forum.kee.pm/t/versioning-and-releases/550"
files: |
dist/*