návrat gravitace????? #262
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: Build | |
| on: | |
| push: | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch main branch | |
| run: git fetch origin amogus:amogus | |
| continue-on-error: true | |
| - name: Setup Deno | |
| uses: denoland/setup-deno@v1 | |
| - name: Run Deno lint | |
| run: deno lint | |
| id: lint | |
| continue-on-error: true | |
| # if ok: build and deploy | |
| - name: Setup Docker Buildx | |
| if: ${{ steps.lint.outcome == 'success' }} | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to ghcr.io | |
| if: ${{ steps.lint.outcome == 'success' }} | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| if: ${{ steps.lint.outcome == 'success' }} | |
| uses: docker/build-push-action@v3 | |
| with: | |
| push: true | |
| tags: ghcr.io/0d9e-tech/web:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Deploy | |
| if: ${{ github.ref == 'refs/heads/amogus' && steps.lint.outcome == 'success' }} | |
| run: | | |
| curl --fail-with-body --no-progress-meter -i https://0d9e.tech/deploy -X POST -H "x-token: ${{ secrets.DEPLOY_TOKEN }}" | |
| # else: revert the commit(s) | |
| - name: Revert commit(s) | |
| if: ${{ steps.lint.outcome != 'success' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| before=${{ github.event.before }} | |
| if [ "$before" = "0000000000000000000000000000000000000000" ]; then | |
| before=$(git merge-base amogus HEAD) | |
| fi | |
| gh api \ | |
| --method POST \ | |
| /repos/${{ github.repository }}/commits/${{ github.sha }}/comments \ | |
| -f 'body=Bruh, learn to code' | |
| git reset --hard $before | |
| git push origin HEAD:${{ github.ref }} --force |