build: Update node version to 20 and package dependencies #2055
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: | |
pull_request: | |
push: | |
branches-ignore: | |
- gh-pages | |
jobs: | |
tool: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Install | |
uses: NullVoxPopuli/action-setup-pnpm@v2 | |
with: | |
node-version: 20 | |
pnpm-version: 8 | |
- name: Set env | |
run: node ./scripts/info.js | |
- name: Build | |
run: pnpm build:tool | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tool | |
path: ./dist/tool | |
- name: Test | |
run: pnpm test:tool | |
- name: Prepare release | |
if: github.ref == 'refs/heads/master' | |
# zip is not working with symbolic link | |
run: | | |
cd ./dist/tool | |
pnpm install --prod --no-lockfile --node-linker=hoisted | |
zip -r ../../release.zip . | |
- name: Publish release | |
uses: ncipollo/[email protected] | |
if: github.ref == 'refs/heads/master' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ github.event.head_commit.message }} | |
tag: v${{ env.PACKAGE_VERSION }} | |
commit: ${{ github.sha }} | |
artifacts: ./release.zip | |
allowUpdates: true | |
server: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Install | |
uses: NullVoxPopuli/action-setup-pnpm@v2 | |
with: | |
node-version: 20 | |
pnpm-version: 8 | |
- name: Set env | |
run: node ./scripts/info.js | |
- name: Build | |
run: pnpm build:server | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: server | |
path: ./dist | |
- name: Test | |
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 }} | |
DB_PATH: db | |
DB_REPO: EhTagTranslation/Database | |
run: pnpm test:server | |
- name: Deploy | |
if: github.ref == 'refs/heads/master' | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
run: flyctl deploy --remote-only | |
browser: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Install | |
uses: NullVoxPopuli/action-setup-pnpm@v2 | |
with: | |
node-version: 20 | |
pnpm-version: 8 | |
- name: Set env | |
run: node ./scripts/info.js | |
- name: Build | |
run: pnpm build:browser | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: browser | |
path: ./dist/browser | |
- name: Test | |
run: pnpm test:browser |