From 77630c81795778ad72610c3d6ed6877a21493ab6 Mon Sep 17 00:00:00 2001 From: Onur Kerimov Date: Tue, 2 Jan 2024 14:28:56 +0300 Subject: [PATCH] Modify job --- .github/workflows/static.yaml | 105 ++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/static.yaml diff --git a/.github/workflows/static.yaml b/.github/workflows/static.yaml new file mode 100644 index 0000000..e150088 --- /dev/null +++ b/.github/workflows/static.yaml @@ -0,0 +1,105 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: 'pages' + cancel-in-progress: true + +jobs: + sync: + name: 'Submodules Sync' + runs-on: ubuntu-latest + + # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest + defaults: + run: + shell: bash + + steps: + # Checkout the repository to the GitHub Actions runner + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.CI_TOKEN }} + submodules: true + + # Update references + - name: Git Submodule Update + run: | + git pull --recurse-submodules + git submodule update --remote --recursive + + - name: Commit update + run: | + git config --global user.name 'Git bot' + git config --global user.email 'bot@noreply.github.com' + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + git commit -am "Auto updated submodule references" && git push || echo "No changes to commit" + # Single deploy job since we're just deploying + deploy: + needs: sync + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-npm-store-${{ hashFiles('**/yarn-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-npm-store- + + - name: Install dependencies + run: yarn install + + - name: Build + run: yarn build + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + # with: + # # Upload entire repository + # path: './storybook-static' + with: + # Upload dist repository + path: './build' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file