diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 4207ee6..67c93a5 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -1,14 +1,14 @@ -name: Build and Deploy +name: "Build and Deploy" on: push: branches: - - 'master' - - 'main' + - "master" + - "main" pull_request: branches: - - 'master' - - 'main' + - "master" + - "main" env: IS_PUSH: ${{ github.event_name == 'push' }} @@ -16,21 +16,19 @@ env: jobs: build: - name: Build and Deploy + name: "Build and Deploy" runs-on: ubuntu-latest container: # image: ubuntu:latest options: --volume "${{ secrets.NGINX_HTML_DIRECTORY }}:/usr/share/nginx/html:rw" steps: - - - name: Checkout + - name: "Checkout" uses: actions/checkout@v4 with: # lfs: true persist-credentials: true - - - # https://gitea.com/gitea/act_runner/issues/164#issuecomment-739652 - name: Checkout LFS + - # https://gitea.com/gitea/act_runner/issues/164#issuecomment-739652 + name: "Checkout LFS" run: | git lfs install AUTH=$(git config --get --local http.${{ github.server_url }}/.extraheader) @@ -38,8 +36,7 @@ jobs: git config --local http.${{ github.server_url }}/batch.extraheader "$AUTH" git lfs fetch git lfs checkout - - - name: Get Metadata + - name: "Get Metadata" id: meta run: | branchName=${GITHUB_REF#refs/heads/} @@ -58,27 +55,21 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "TAG_NAME=$tagName" >> $GITHUB_OUTPUT echo "PRERELEASE=$preRelease" >> $GITHUB_OUTPUT - - - name: Setup pnpm + - name: "Setup pnpm" uses: pnpm/action-setup@v4.0.0 - - - name: Install dependencies + - name: "Install dependencies" run: pnpm install - - - name: Compile Sass and minify CSS and Javascript + - name: "Compile Sass and minify CSS and Javascript" run: pnpm run build - - - name: Append version query arg to asset URLs + - name: "Append version query arg to asset URLs" env: VERSION: ${{ steps.meta.outputs.VERSION }} run: | echo "VERSION = $VERSION" find public -type f -name '*.html' -exec sed -i "s/\"\([^\"?]\+\.css\)\"/\"\1?v=$VERSION\"/g" {} + find public -type f -name '*.html' -exec sed -i "s/\"\([^\"?]\+\.js\)\"/\"\1?v=$VERSION\"/g" {} + - - - name: Minify HTML + - name: "Minify HTML" run: | pnpm html-minifier-terser --collapse-whitespace --minify-css --minify-js --remove-comments --input-dir public --output-dir public --file-ext html - - - name: Copy files to public folder + - name: "Copy files to public folder" run: mkdir -p /usr/share/nginx/html/fpv; cp -rf public/* /usr/share/nginx/html/fpv