-
-
Notifications
You must be signed in to change notification settings - Fork 106
66 lines (63 loc) · 2.04 KB
/
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
---
name: 'Kitsu release'
on:
push:
branches:
- master
tags:
- '*'
jobs:
make_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build release
env:
NODE_OPTIONS: '--max_old_space_size=8192'
run: |
echo "Node.js $(node -v)"
echo "npm v$(npm -v)"
npm ci
npm run build
GIT_COMMIT="$(git rev-parse HEAD)"
GIT_TAG="$(git describe --tags)"
KITSU_VERSION="$(echo ${GIT_TAG} | sed 's/^v//;s/-build//')"
echo "${KITSU_VERSION}" > dist/.version.txt
echo "${GIT_COMMIT}" > dist/.commit.txt
echo "${GIT_TAG}" > dist/.tag.txt
CHECKSUM_FILENAME="kitsu-${KITSU_VERSION}.SHA512"
ARTEFACT_FILENAME="kitsu-${KITSU_VERSION}.tgz"
(cd dist && tar cvzf "../${ARTEFACT_FILENAME}" .)
sha512sum "${ARTEFACT_FILENAME}" > "${CHECKSUM_FILENAME}"
- name: Create release
if: startsWith(github.ref, 'refs/tags')
uses: ncipollo/release-action@v1
id: create_release
with:
artifacts: 'kitsu-*.tgz,kitsu-*.SHA512'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update "build" branch
if: startsWith(github.ref, 'refs/tags')
run: |
KITSU_VERSION="$(cat dist/.version.txt)"
mv dist ..
git checkout build
git reset --hard origin/build
test -d dist && git rm -rf dist
test -d dist && rm -rf dist
mv ../dist .
git add -f dist
git config --global user.email "no-reply@cg-wire.com"
git config --global user.name "CGWire bot"
git commit -m "New release (${KITSU_VERSION})"
git tag ${KITSU_VERSION}-build
- name: Push changes
if: startsWith(github.ref, 'refs/tags')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
branch: build
force: true