Skip to content

Fix misc sheet issues #614

Fix misc sheet issues

Fix misc sheet issues #614

name: Build New Release
on:
pull_request:
types: [closed]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Get version
id: get-version
run: |
echo "version=$(printf '%s' '${{ github.event.pull_request.title }}' | awk '{print $3}')" >> $GITHUB_OUTPUT
- name: Set git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Get commit msg
id: get-commit-msg
run: |
if [[ -z "${{ steps.get-version.outputs.version }}" ]]; then
echo "msg=deploy: $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "title-deploy=Deploy ref $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
else
echo "msg=deploy: version ${{ steps.get-version.outputs.version }} $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "title-deploy=Deploy version ${{ steps.get-version.outputs.version }} $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
fi
- name: Yarn install
run: |
yarn install --immutable --immutable-cache
- name: Setup .env
run: |
printf '%s' "$ENVFILE" > apps/frontend/.env.local
env:
ENVFILE: ${{ vars.ENVFILE }}
- name: Build genshin-optimizer
run: |
NX_URL_GITHUB_GO_CURRENT_VERSION="https://github.com/${{ github.repository }}/commit/$(git rev-parse HEAD)" \
yarn run nx run frontend:build:production
- name: Create Deploy PR
run: |
git fetch origin gh-pages --depth=1
git worktree add ../gh-pages gh-pages --no-checkout
cp -rT dist/apps/frontend ../gh-pages
cd ../gh-pages
git add --all .
git commit -m "${{ steps.get-commit-msg.outputs.msg }}"
git push origin HEAD:actions/deploy-gh-pages --force
gh pr create --base gh-pages --head actions/deploy-gh-pages --title '${{ steps.get-commit-msg.outputs.title-deploy }}' --body ''
env:
GH_TOKEN: ${{ github.token }}
- name: Make release
if: steps.get-version.outputs.version != ''
run: |
gh release create ${{ steps.get-version.outputs.version }} --generate-notes --target $(git rev-parse HEAD)
env:
GH_TOKEN: ${{ github.token }}