Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #22
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: Development | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- mysql_ver: 5.7 | |
distro: debian | |
- mysql_ver: 8 | |
distro: debian | |
- mysql_ver: 8.0.18 # temporary .18 - see README.rst for details. | |
distro: debian | |
env: | |
MYSQL_VER: ${{matrix.mysql_ver}} | |
DISTRO: ${{matrix.distro}} | |
DOCKER_CLIENT_TIMEOUT: "120" | |
COMPOSE_HTTP_TIMEOUT: "120" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Compile image | |
run: | | |
docker-compose -f dist/${DISTRO}/LNX-docker-compose.yaml build | |
IMAGE=$(docker images --filter "reference=datajoint/*" --format "{{.Repository}}") | |
TAG=$(docker images --filter "reference=datajoint/*" --format "{{.Tag}}") | |
docker save "${IMAGE}:${TAG}" | gzip > "image-mysql-${MYSQL_VER}-${DISTRO}.tar.gz" | |
- name: Add image artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{format('image-mysql-{0}-{1}', matrix.mysql_ver, matrix.distro)}} | |
path: > | |
${{format('image-mysql-{0}-{1}.tar.gz', matrix.mysql_ver, matrix.distro)}} | |
retention-days: 1 | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- mysql_ver: 5.7 | |
distro: debian | |
- mysql_ver: 8 | |
distro: debian | |
- mysql_ver: 8.0.18 # temporary .18 - see README.rst for details. | |
distro: debian | |
env: | |
MYSQL_VER: ${{matrix.mysql_ver}} | |
DISTRO: ${{matrix.distro}} | |
DOCKER_CLIENT_TIMEOUT: "120" | |
COMPOSE_HTTP_TIMEOUT: "120" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fetch image artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{format('image-mysql-{0}-{1}', matrix.mysql_ver, matrix.distro)}} | |
- name: Verify image | |
run: | | |
docker load < "image-mysql-${MYSQL_VER}-${DISTRO}.tar.gz" | |
docker-compose -f dist/${DISTRO}/LNX-docker-compose.yaml up \ | |
--build --exit-code-from db | |
publish: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- mysql_ver: 5.7 | |
distro: debian | |
- mysql_ver: 8 | |
distro: debian | |
- mysql_ver: 8.0.18 # temporary .18 - see README.rst for details. | |
distro: debian | |
env: | |
MYSQL_VER: ${{matrix.mysql_ver}} | |
DISTRO: ${{matrix.distro}} | |
DOCKER_USERNAME: ${{secrets.docker_username}} | |
DOCKER_PASSWORD: ${{secrets.docker_password}} | |
steps: | |
- name: Fetch image artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{format('image-mysql-{0}-{1}', matrix.mysql_ver, matrix.distro)}} | |
- name: Publish image | |
run: | | |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
docker load < "image-mysql-${MYSQL_VER}-${DISTRO}.tar.gz" | |
IMAGE=$(docker images --filter "reference=datajoint/*" --format "{{.Repository}}") | |
TAG=$(docker images --filter "reference=datajoint/*" --format "{{.Tag}}") | |
docker push "${IMAGE}:${TAG}" | |
docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}" | |
docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}" | |
[ "$MYSQL_VER" == "5.7" ] && [ "$DISTRO" == "debian" ] \ | |
&& docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \ | |
&& docker push "${IMAGE}:latest" \ | |
|| echo "skipping 'latest' tag..." |