Skip to content

Merge pull request #1197 from frankrousseau/master #123

Merge pull request #1197 from frankrousseau/master

Merge pull request #1197 from frankrousseau/master #123

Workflow file for this run

---
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 "[email protected]"
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