fix(api): Existing alias check logic #69
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Set up Docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.repository }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx- | |
| - name: GHCR registry auth | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ghcr.io/octocondev/octocon:${{ github.sha }},ghcr.io/octocondev/octocon:latest | |
| build-args: | | |
| COMMIT_SHA=${{ github.sha }} | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
| - name: Save Docker image as tarball | |
| run: | | |
| docker pull ghcr.io/octocondev/octocon:${{ github.sha }} | |
| docker save ghcr.io/octocondev/octocon:${{ github.sha }} -o /tmp/image.tar | |
| - name: Upload image artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: image | |
| path: /tmp/image.tar | |
| # This ugly bit is necessary if you don't want your cache to grow forever | |
| # until it hits GitHub's limit. | |
| # Temp fix | |
| # https://github.com/docker/build-push-action/issues/252 | |
| # https://github.com/moby/buildkit/issues/1896 | |
| - name: Move cache | |
| run: | | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
| fly_deploy: | |
| name: Fly Deploy | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v2 | |
| - name: Setup Flyctl | |
| uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy to Fly.io | |
| run: flyctl deploy -a octo -i ghcr.io/octocondev/octocon:latest --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| dedi_deploy: | |
| name: Dedi Deploy | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | |
| steps: | |
| - name: Tailscale | |
| uses: tailscale/github-action@v4 | |
| with: | |
| oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
| oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
| tags: tag:ci | |
| ping: octohost | |
| - name: Create SSH key | |
| run: | | |
| install -m 600 -D /dev/null ~/.ssh/id_ed25519 | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | |
| - name: Deploy to dedicated server | |
| run: | | |
| ssh -p 6972 restarter@octohost |