.github/workflows/tests.yml: Deploy Docker image

Deploy the latest Docker image on a push to master.
Deploy a tagged Docker image upon publication of a release.
This commit is contained in:
Shaun Jackman 2020-03-25 12:27:50 -07:00
parent fa8fe0fc39
commit f3307193e0

View File

@ -3,6 +3,9 @@ on:
push: push:
branches: master branches: master
pull_request: [] pull_request: []
release:
types:
- published
jobs: jobs:
tests: tests:
if: github.repository == 'Homebrew/brew' if: github.repository == 'Homebrew/brew'
@ -140,6 +143,22 @@ jobs:
run: | run: |
if [ "$RUNNER_OS" = "Linux" ]; then if [ "$RUNNER_OS" = "Linux" ]; then
docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut
docker tag homebrew_sut brew
else else
brew test-bot brew test-bot
fi fi
- name: Deploy the latest Docker image
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master'
run: |
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
docker tag brew docker.pkg.github.com/homebrew/brew/brew
docker push docker.pkg.github.com/homebrew/brew/brew
- name: Deploy the tagged Docker image
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
run: |
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
v=${GITHUB_REF:10}
docker tag brew "docker.pkg.github.com/homebrew/brew/brew:$v"
docker push "docker.pkg.github.com/homebrew/brew/brew:$v"