|
| 1 | +name: Upload Image |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-specific-architecture: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + arch: [amd64, arm64] |
| 12 | + runs-on: ${{ fromJson('{"amd64":"ubuntu-latest", "arm64":["self-hosted", "Linux", "ARM64"]}')[matrix.arch] }} |
| 13 | + steps: |
| 14 | + - name: checkout codes |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - uses: actions/setup-node@v3 |
| 18 | + with: |
| 19 | + node-version: 14 |
| 20 | + - uses: actions/setup-go@v3 |
| 21 | + with: |
| 22 | + go-version: '^1.18.1' |
| 23 | + |
| 24 | + - name: install dependencies |
| 25 | + run: | |
| 26 | + sudo apt update -y |
| 27 | + sudo apt install g++ build-essential python3 -y |
| 28 | +
|
| 29 | + - name: build web-show images |
| 30 | + env: |
| 31 | + ARCH: ${{ matrix.arch }} |
| 32 | + run: | |
| 33 | + make build |
| 34 | + IMAGE_TAG=latest-$ARCH make image |
| 35 | +
|
| 36 | + - name: log in to GitHub Docker Registry |
| 37 | + uses: docker/login-action@v1 |
| 38 | + with: |
| 39 | + registry: ghcr.io |
| 40 | + username: ${{ github.actor }} |
| 41 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + |
| 43 | + - name: upload web-show |
| 44 | + env: |
| 45 | + ARCH: ${{ matrix.arch }} |
| 46 | + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} |
| 47 | + run: | |
| 48 | + # ${VAR,,} convert VAR to lower case |
| 49 | + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-$ARCH |
| 50 | + |
| 51 | + |
| 52 | + upload-manifest: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: build-specific-architecture |
| 55 | + steps: |
| 56 | + - name: build manifest |
| 57 | + env: |
| 58 | + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} |
| 59 | + run: | |
| 60 | + # ${VAR,,} convert VAR to lower case |
| 61 | + docker manifest create ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest \ |
| 62 | + ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-amd64 \ |
| 63 | + ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-arm64 |
| 64 | +
|
| 65 | + docker manifest annotate ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest \ |
| 66 | + ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-amd64 \ |
| 67 | + --os linux --arch amd64 |
| 68 | + docker manifest annotate ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest \ |
| 69 | + ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-arm64 \ |
| 70 | + --os linux --arch arm64 |
| 71 | +
|
| 72 | + - name: Log in to GitHub Docker Registry |
| 73 | + uses: docker/login-action@v1 |
| 74 | + with: |
| 75 | + registry: ghcr.io |
| 76 | + username: ${{ github.actor }} |
| 77 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + |
| 79 | + - name: Upload Chaos Mesh |
| 80 | + env: |
| 81 | + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} |
| 82 | + run: | |
| 83 | + # ${VAR,,} convert VAR to lower case |
| 84 | + docker manifest push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest |
0 commit comments