Skip to content

Ruby updates (#399) #32

Ruby updates (#399)

Ruby updates (#399) #32

Workflow file for this run

name: Build docker image
on:
# schedule:
# - cron: '0 0 */3 * *' # @at 0h0m0s every 3 days
release:
types: [created]
push:
branches: [master, main]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags
#
- name: Prepare
id: prep
run: |
if [[ $GITHUB_EVENT_NAME == schedule ]]; then
sudo apt-get update -y
sudo apt-get install -y curl jq
LATEST_TAG=$(curl -sSL https://api.github.com/repos/mersea/mersea/releases/latest | jq -r .tag_name)
git checkout $LATEST_TAG
export GITHUB_REF=refs/tags/$LATEST_TAG
fi
#
#
#
DOCKER_IMAGE=mersea/mersea
VERSION=edge
if [[ $GITHUB_REF == refs/heads/* ]]; then
# Branch name
VERSION=${GITHUB_REF#refs/heads/}
fi
if [[ $GITHUB_REF == refs/tags/* ]]; then
# Tag name
VERSION=${GITHUB_REF#refs/tags/}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}
#
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
#
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
#
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
#
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: .
push: true
tags: ${{ steps.prep.outputs.tags }}