Skip to content

3.2.3

3.2.3 #430

Workflow file for this run

name: docker publish
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
release:
types:
- created
- edited
- prereleased
- published
- released
jobs:
build-django:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build django image
run: |
docker build . --file docker/Dockerfile --tag b3lb
docker save b3lb > /tmp/b3lb.tar
- name: Upload django artifact
uses: actions/upload-artifact@v2
with:
name: b3lb
path: /tmp/b3lb.tar
build-pypy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build django image
run: |
docker build . --file docker/Dockerfile.pypy --tag b3lb-pypy
docker save b3lb-pypy > /tmp/b3lb-pypy.tar
- name: Upload django artifact
uses: actions/upload-artifact@v2
with:
name: b3lb-pypy
path: /tmp/b3lb-pypy.tar
build-render:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build render image
run: |
docker build . --file docker/Dockerfile.render --tag b3lb-render
docker save b3lb-render > /tmp/b3lb-render.tar
- name: Upload django artifact
uses: actions/upload-artifact@v2
with:
name: b3lb-render
path: /tmp/b3lb-render.tar
build-static:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build static image
run: |
docker build . --file docker/Dockerfile.static --tag b3lb-static
docker save b3lb-static > /tmp/b3lb-static.tar
- name: Upload static artifact
uses: actions/upload-artifact@v2
with:
name: b3lb-static
path: /tmp/b3lb-static.tar
build-dev:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build dev image
run: |
docker build . --file docker/Dockerfile.dev --tag b3lb-dev
docker save b3lb-dev > /tmp/b3lb-dev.tar
- name: Upload dev artifact
uses: actions/upload-artifact@v2
with:
name: b3lb-dev
path: /tmp/b3lb-dev.tar
push-latest:
needs: build-dev
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: b3lb-dev
path: /tmp
- name: Push images
run: |
docker load < /tmp/b3lb-dev.tar
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID =$IMAGE_ID
echo IMAGE_TAG=latest
docker tag b3lb-dev $IMAGE_ID/b3lb-dev:latest
docker push $IMAGE_ID/b3lb-dev:latest
push-release:
needs: ["build-django", "build-pypy", "build-dev", "build-static", "build-render"]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Download django artifact
uses: actions/download-artifact@v2
with:
name: b3lb
path: /tmp
- name: Download django pypy artifact
uses: actions/download-artifact@v2
with:
name: b3lb-pypy
path: /tmp
- name: Download render artifact
uses: actions/download-artifact@v2
with:
name: b3lb-render
path: /tmp
- name: Download dev artifact
uses: actions/download-artifact@v2
with:
name: b3lb-dev
path: /tmp
- name: Download static artifact
uses: actions/download-artifact@v2
with:
name: b3lb-static
path: /tmp
- name: Push images
run: |
docker load < /tmp/b3lb.tar
docker load < /tmp/b3lb-pypy.tar
docker load < /tmp/b3lb-render.tar
docker load < /tmp/b3lb-dev.tar
docker load < /tmp/b3lb-static.tar
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo IMAGE_ID =$IMAGE_ID
echo IMAGE_TAG=latest
docker tag b3lb $IMAGE_ID/b3lb:$VERSION
docker tag b3lb-pypy $IMAGE_ID/b3lb-pypy:$VERSION
docker tag b3lb-render $IMAGE_ID/b3lb-render:$VERSION
docker tag b3lb-dev $IMAGE_ID/b3lb-dev:$VERSION
docker tag b3lb-static $IMAGE_ID/b3lb-static:$VERSION
docker push $IMAGE_ID/b3lb:$VERSION
docker push $IMAGE_ID/b3lb-pypy:$VERSION
docker push $IMAGE_ID/b3lb-render:$VERSION
docker push $IMAGE_ID/b3lb-dev:$VERSION
docker push $IMAGE_ID/b3lb-static:$VERSION