docker #3
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
| # Publishes the Docker image. | |
| name: docker | |
| on: | |
| workflow_dispatch: {} | |
| push: | |
| tags: | |
| - v* | |
| jobs: | |
| build: | |
| name: build and push | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker CLI | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push tagged | |
| uses: docker/build-push-action@v6 | |
| if: github.event_name != 'workflow_dispatch' | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ghcr.io/ithacaxyz/rpc-tester:latest | |
| ghcr.io/ithacaxyz/rpc-tester:${{ github.ref_name }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Get short commit | |
| if: github.event_name == 'workflow_dispatch' | |
| id: vars | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Build and push dispatched | |
| uses: docker/build-push-action@v6 | |
| if: github.event_name == 'workflow_dispatch' | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ghcr.io/ithacaxyz/rpc-tester:${{ steps.vars.outputs.sha_short }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |