|
| 1 | +--- |
| 2 | +name: lib |
| 3 | + |
| 4 | +on: # yamllint disable-line rule:truthy |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: >- |
| 9 | + ${{ |
| 10 | + github.workflow |
| 11 | + }}-${{ |
| 12 | + github.event.pull_request.number || github.sha |
| 13 | + }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + pre-setup: |
| 18 | + name: ⚙️ Pre-set global build settings |
| 19 | + runs-on: ubuntu-20.04 |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + outputs: |
| 24 | + container-platforms: ${{ steps.container.outputs.platforms }} |
| 25 | + steps: |
| 26 | + - name: Calculate container attributes |
| 27 | + id: container |
| 28 | + shell: bash |
| 29 | + run: >- |
| 30 | + PLATFORMS="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x"; |
| 31 | + echo "::set-output name=platforms::$PLATFORMS" |
| 32 | +
|
| 33 | + ghcr-latest: |
| 34 | + runs-on: ubuntu-20.04 |
| 35 | + permissions: |
| 36 | + packages: write |
| 37 | + if: success() |
| 38 | + needs: |
| 39 | + - pre-setup # transitive, for accessing settings |
| 40 | + name: 🐳 ghcr:latest |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v3 |
| 44 | + with: |
| 45 | + ref: ${{ github.event.inputs.release-commitish }} |
| 46 | + - name: Login to GHCR |
| 47 | + uses: docker/login-action@v2 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + - name: Set up Docker Buildx |
| 53 | + id: buildx |
| 54 | + uses: docker/setup-buildx-action@v2 |
| 55 | + # See https://github.com/docker/buildx/issues/850#issuecomment-996408167 |
| 56 | + with: |
| 57 | + version: v0.7.0 |
| 58 | + buildkitd-flags: --debug |
| 59 | + config: .github/buildkitd.toml |
| 60 | + install: true |
| 61 | + - name: Enable Multiarch # This slows down arm build by 4-5x |
| 62 | + run: | |
| 63 | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 64 | + - name: Create builder |
| 65 | + run: | |
| 66 | + docker buildx create --name proxypybuilder |
| 67 | + docker buildx use proxypybuilder |
| 68 | + docker buildx inspect |
| 69 | + docker buildx ls |
| 70 | + - name: Push base to GHCR |
| 71 | + run: >- |
| 72 | + docker buildx build |
| 73 | + --push |
| 74 | + --platform ${{ |
| 75 | + needs.pre-setup.outputs.container-platforms |
| 76 | + }} |
| 77 | + -t ghcr.io/abhinavsingh/proxy.py:base |
| 78 | + -f DockerfileBase . |
| 79 | +... |
0 commit comments