Merge pull request #19 from joinrpg/dependabot/github_actions/actions… #55
This file contains hidden or 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: Publish site to S3 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| if: github.ref != 'refs/heads/main' | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v6.0.2 | |
| - name: Build only | |
| uses: shalzz/zola-deploy-action@v0.22.1 | |
| env: | |
| BUILD_ONLY: true | |
| - name: Create artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: site | |
| path: public | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/master' | |
| steps: | |
| - name: Download a single artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: site | |
| path: public | |
| - name: Set up S3cmd cli tool | |
| uses: s3-actions/s3cmd@v3.0.0 | |
| with: | |
| provider: yandex | |
| region: ru-central1 | |
| access_key: ${{ secrets.SYNC_ACCESS_ID }} | |
| secret_key: ${{ secrets.SYNC_ACCESS_SECRET }} | |
| - name: sync to s3 | |
| run: | | |
| cd public | |
| s3cmd sync --recursive --exclude "*.css" --exclude "*.js" * s3://code.rpg.ru | |
| s3cmd sync --recursive --include "*.css" * --mime-type="text/css" s3://code.rpg.ru | |
| s3cmd sync --recursive --include "*.js" * --mime-type="application/javascript" s3://code.rpg.ru | |