use 'cask' to run docker #7
This file contains 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
name: build+push-docker-image | |
on: [push] | |
jobs: | |
build: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install homebrew | |
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
- name: install docker | |
run: brew cask install docker | |
- name: build | |
run: docker build -t ${{ github.repository }}:${{ github.sha }} . | |
- name: Login to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Tag Docker image | |
run: docker tag ${{ github.repository }}:${{ github.sha }} ${{ github.repository }}:latest | |
- name: Push Docker image | |
run: | | |
docker push ${{ github.repository }}:${{ github.sha }} | |
docker push ${{ github.repository }}:latest | |