Skip to content

Release

Release #17

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version'
required: true
last_release_commit_hash:
description: 'Last release commit hash'
required: true
translation_start_date:
description: 'Translation changelog start date (yyyy-mm-dd)'
required: true
translation_end_date:
description: 'Translation changelog end date (yyyy-mm-dd)'
required: true
summary:
description: 'Summary'
required: true
defaults:
run:
working-directory: master
jobs:
release:
name: Create changelog, build artifacts and publish release
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
path: master
fetch-depth: 0
- name: Set up NodeJs
uses: actions/setup-node@v4
with:
node-version-file: './master/package.json'
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-release-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: |
yarn ci
- name: Update weblate and github tokens in tokens.json for the changelog creation scripts
run: |
jq --arg weblate_token "${{ secrets.WEBLATE_TOKEN }}" \
--arg github_token "${{ secrets.GITHUB_TOKEN }}" \
'.weblateToken = $weblate_token | .githubToken = $github_token' \
./tools/scripts/token.template.json > tmp.json
mv tmp.json ./tools/scripts/tokens.json
- name: Create changelog
id: changelog
run: |
yarn createChangelog --sha ${{ github.event.inputs.last_release_commit_hash }} > changelog_output.txt
yarn createTranslationChangelog --ad ${{ github.event.inputs.translation_start_date }} --bd ${{ github.event.inputs.translation_end_date }} > translation_changelog_output.txt
- name: Save changelog to file
run: |
echo "${{ github.event.inputs.summary }}" > new_changelog.txt
cat changelog_output.txt >> new_changelog.txt
cat translation_changelog_output.txt >> new_changelog.txt
cat CHANGELOG.md >> new_changelog.txt
mv new_changelog.txt CHANGELOG.md
- name: Generate Tag Name
id: GenTagName
run: |
genTag="v${{ github.event.inputs.release_version }}"
echo "::set-output name=value::$genTag"
- name: Update UI version to server version mapping file
run: |
commit_count="r$(git rev-list --count HEAD)"
jq --arg commit_count "$commit_count" '.[0].uiVersion |= $commit_count | map(select(.tag != "PREVIEW"))' versionToServerVersionMapping.json > updatedVersionToServerVersionMapping.json
mv updatedVersionToServerVersionMapping.json versionToServerVersionMapping.json
- name: Commit changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git commit -a --amend --no-edit
git tag ${{ steps.GenTagName.outputs.value }}
- name: Push changes and tag
run: |
git push origin HEAD:master
git push origin ${{ steps.GenTagName.outputs.value }}
- name: Build webUI
run: |
yarn ci
yarn build
yarn build-zip
yarn build-md5
ls buildZip
for file in buildZip/*-r.*; do
mv "$file" "${file%-r.*}-${{ steps.GenTagName.outputs.value }}"
done
ls buildZip
- name: Upload Release
uses: ncipollo/release-action@v1
with:
artifacts: "master/buildZip/*"
owner: "schroda"
repo: "Suwayomi-WebUI"
tag: ${{ steps.GenTagName.outputs.value }}