update #322
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: Docker | |
on: | |
create: | |
tags: | |
- v* | |
pull_request: | |
push: | |
jobs: | |
test: | |
name: Docker compose | |
runs-on: ubuntu-latest | |
env: | |
COMPOSE_FILE: docker-compose.yml | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build docker images | |
run: docker-compose build | |
build: | |
name: Docker build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get branch name | |
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push branch | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: microweber/package-builder-worker:${{ env.BRANCH }} | |
build-args: | | |
BRANCH=${{ env.BRANCH }} | |
- name: Build and push latest | |
id: docker_build_latest | |
if: github.ref == 'refs/heads/master' | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: microweber/package-builder-worker:latest | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |