objective categorical abstract machine language personal data server
at main 115 lines 4.3 kB view raw
1name: ci 2 3on: 4 push: 5 branches: 6 - main 7 8jobs: 9 build-amd64: 10 runs-on: ubuntu-latest 11 permissions: 12 packages: write 13 steps: 14 - uses: docker/login-action@v3 15 with: 16 registry: ghcr.io 17 username: ${{ github.actor }} 18 password: ${{ secrets.GITHUB_TOKEN }} 19 20 - uses: docker/setup-buildx-action@v3 21 22 - uses: actions/checkout@v6 23 24 - name: Set short rev 25 id: rev_parse 26 run: echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT 27 28 - name: Build and push 29 uses: Wandalen/wretry.action@v3 30 with: 31 attempt_limit: 3 32 retry_condition: steps._this.outputs.retryable != 'false' 33 command: | 34 set +e 35 output=$(docker buildx build \ 36 --push \ 37 --tag ghcr.io/futurgh/pegasus:${{ github.sha }}-amd64 \ 38 --build-arg GIT_REV=${{ steps.rev_parse.outputs.git_rev }} \ 39 --cache-from type=gha,scope=amd64 \ 40 --cache-to type=gha,scope=amd64,mode=max \ 41 . 2>&1) 42 exit_code=$? 43 echo "$output" 44 if [ $exit_code -eq 0 ]; then 45 exit 0 46 elif echo "$output" | grep -qE "download failed|50[0-9]|Connection (refused|reset|timed out)"; then 47 echo "retrying network error" 48 exit 1 49 else 50 echo "retryable=false" >> $GITHUB_OUTPUT 51 exit 1 52 fi 53 54 build-arm64: 55 runs-on: ubuntu-24.04-arm 56 permissions: 57 packages: write 58 steps: 59 - uses: docker/login-action@v3 60 with: 61 registry: ghcr.io 62 username: ${{ github.actor }} 63 password: ${{ secrets.GITHUB_TOKEN }} 64 65 - uses: docker/setup-buildx-action@v3 66 67 - uses: actions/checkout@v6 68 69 - name: Set short rev 70 id: rev_parse 71 run: echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT 72 73 - name: Build and push 74 uses: Wandalen/wretry.action@v3 75 with: 76 attempt_limit: 3 77 retry_condition: steps._this.outputs.retryable != 'false' 78 command: | 79 set +e 80 output=$(docker buildx build \ 81 --push \ 82 --tag ghcr.io/futurgh/pegasus:${{ github.sha }}-arm64 \ 83 --build-arg GIT_REV=${{ steps.rev_parse.outputs.git_rev }} \ 84 --cache-from type=gha,scope=arm64 \ 85 --cache-to type=gha,scope=arm64,mode=max \ 86 . 2>&1) 87 exit_code=$? 88 echo "$output" 89 if [ $exit_code -eq 0 ]; then 90 exit 0 91 elif echo "$output" | grep -qE "download failed|50[0-9]|Connection (refused|reset|timed out)"; then 92 echo "retrying network error" 93 exit 1 94 else 95 echo "retryable=false" >> $GITHUB_OUTPUT 96 exit 1 97 fi 98 99 merge: 100 runs-on: ubuntu-latest 101 needs: [build-amd64, build-arm64] 102 permissions: 103 packages: write 104 steps: 105 - uses: docker/login-action@v3 106 with: 107 registry: ghcr.io 108 username: ${{ github.actor }} 109 password: ${{ secrets.GITHUB_TOKEN }} 110 111 - name: Create multi-arch manifest 112 run: | 113 docker buildx imagetools create -t ghcr.io/futurgh/pegasus:latest \ 114 ghcr.io/futurgh/pegasus:${{ github.sha }}-amd64 \ 115 ghcr.io/futurgh/pegasus:${{ github.sha }}-arm64