|
| 1 | +name: Docker |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + docker: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + packages: write |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Login to GitHub Container Registry |
| 19 | + uses: docker/login-action@v3 |
| 20 | + with: |
| 21 | + registry: ghcr.io |
| 22 | + username: ${{ github.actor }} |
| 23 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + |
| 25 | + - name: Build base image |
| 26 | + run: docker compose build base |
| 27 | + |
| 28 | + - name: Build base dependent images |
| 29 | + run: docker compose build mdbook shell-* |
| 30 | + |
| 31 | + - name: Build shell-* dependent image |
| 32 | + run: docker compose build shell |
| 33 | + |
| 34 | + - name: Build shell dependent image |
| 35 | + run: docker compose build vhs |
| 36 | + |
| 37 | + - name: Upload the images |
| 38 | + run: | |
| 39 | + tag=latest |
| 40 | + [[ "$GITHUB_REF" =~ ^refs/tags/ ]] && tag="${GITHUB_REF/refs\/tags\//}" |
| 41 | + docker image tag ghcr.io/carapace-sh/base ghcr.io/carapace-sh/base:${tag} |
| 42 | + docker image tag ghcr.io/carapace-sh/mdbook ghcr.io/carapace-sh/mdbook:${tag} |
| 43 | + docker image tag ghcr.io/carapace-sh/shell-bash-ble ghcr.io/carapace-sh/shell-bash-ble:${tag} |
| 44 | + docker image tag ghcr.io/carapace-sh/shell-elvish ghcr.io/carapace-sh/shell-elvish:${tag} |
| 45 | + docker image tag ghcr.io/carapace-sh/shell-fish ghcr.io/carapace-sh/shell-fish:${tag} |
| 46 | + docker image tag ghcr.io/carapace-sh/shell-nushell ghcr.io/carapace-sh/shell-nushell:${tag} |
| 47 | + docker image tag ghcr.io/carapace-sh/shell-oil ghcr.io/carapace-sh/shell-oil:${tag} |
| 48 | + docker image tag ghcr.io/carapace-sh/shell-powershell ghcr.io/carapace-sh/shell-powershell:${tag} |
| 49 | + docker image tag ghcr.io/carapace-sh/shell-xonsh ghcr.io/carapace-sh/shell-xonsh:${tag} |
| 50 | + docker image tag ghcr.io/carapace-sh/shell-zsh ghcr.io/carapace-sh/shell-zsh:${tag} |
| 51 | + docker image tag ghcr.io/carapace-sh/shell ghcr.io/carapace-sh/shell:${tag} |
| 52 | + docker image tag ghcr.io/carapace-sh/vhs ghcr.io/carapace-sh/vhs:${tag} |
| 53 | +
|
| 54 | + docker image push ghcr.io/carapace-sh/base:${tag} |
| 55 | + docker image push ghcr.io/carapace-sh/mdbook:${tag} |
| 56 | + docker image push ghcr.io/carapace-sh/shell-bash-ble:${tag} |
| 57 | + docker image push ghcr.io/carapace-sh/shell-elvish:${tag} |
| 58 | + docker image push ghcr.io/carapace-sh/shell-fish:${tag} |
| 59 | + docker image push ghcr.io/carapace-sh/shell-nushell:${tag} |
| 60 | + docker image push ghcr.io/carapace-sh/shell-oil:${tag} |
| 61 | + docker image push ghcr.io/carapace-sh/shell-powershell:${tag} |
| 62 | + docker image push ghcr.io/carapace-sh/shell-xonsh:${tag} |
| 63 | + docker image push ghcr.io/carapace-sh/shell-zsh:${tag} |
| 64 | + docker image push ghcr.io/carapace-sh/shell:${tag} |
| 65 | + docker image push ghcr.io/carapace-sh/vhs:${tag} |
0 commit comments