修改 character:kaori miyazono - 宫园薰 #11044
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- database/* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 | |
- name: Download tool | |
run: ./scripts/init.sh | |
- name: Build | |
run: node --enable-source-maps tool create-release . ./publish | |
## prepare releases | |
- name: Commit release mirror | |
run: > | |
cd ./publish | |
&& (printf '${{ github.sha }}' > ./sha) | |
&& git init | |
&& git config user.email '66814738+ehtagtranslation[bot]@users.noreply.github.com' | |
&& git config user.name 'ehtagtranslation[bot]' | |
&& git add . | |
&& git commit -am 'Release for https://github.com/EhTagTranslation/Database/commit/${{ github.sha }}' | |
&& echo "MIRROR_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Set release note | |
run: node --enable-source-maps tool github-actions set-release-note --mirror-sha '${{ env.MIRROR_SHA }}' | |
# publish releases | |
- name: Create token | |
env: | |
APP_ID: ${{ secrets.APP_ID }} | |
APP_KEY: ${{ secrets.APP_KEY }} | |
APP_INSTALLATION_ID: ${{ secrets.APP_INSTALLATION_ID }} | |
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }} | |
APP_CLIENT_SECRET: ${{ secrets.APP_CLIENT_SECRET }} | |
run: node --enable-source-maps tool github-actions generate-token --env=APP_TOKEN | |
- name: Check latest | |
run: | | |
LATEST_SHA=$(git ls-remote origin master | cut -f1) | |
echo "Current commit: ${{ github.sha }}" | |
echo "Latest commit: $LATEST_SHA" | |
if [[ "$LATEST_SHA" != "${{ github.sha }}" ]]; then | |
echo "::warning::已经有新的版本提交,取消发布" | |
echo "SKIP=true" >> $GITHUB_ENV | |
fi | |
- name: Push release mirror | |
uses: ad-m/github-push-action@master | |
if: ${{ !env.SKIP }} | |
with: | |
github_token: ${{ env.APP_TOKEN }} | |
force: true | |
directory: ./publish | |
repository: EhTagTranslation/DatabaseReleases | |
- name: Upload release | |
uses: ncipollo/[email protected] | |
if: ${{ !env.SKIP }} | |
with: | |
artifacts: ./publish/* | |
name: ${{ env.RELEASE_NAME }} | |
body: ${{ env.RELEASE_BODY }} | |
token: ${{ env.APP_TOKEN }} | |
commit: ${{ github.sha }} | |
tag: ${{ format('v6.{0}.{1}', github.run_number, github.run_attempt) }} | |
- name: Clean releases | |
if: ${{ !env.SKIP }} | |
env: | |
GITHUB_TOKEN: ${{ env.APP_TOKEN }} | |
run: node --enable-source-maps tool github-actions delete-releases |