Skip to content

build

build #54

Workflow file for this run

name: build
on:
schedule:
- cron: "0 11 * * 3"
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
IMAGE_NAME: corilus/sftp
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # for proper signature verification
submodules: true # for shunit2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: tests/shunit2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build debian image
run: |
docker build . \
--pull=true \
--file=Dockerfile \
--tag="$IMAGE_NAME:latest" \
--tag="$IMAGE_NAME:debian" \
--label="org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
--label="org.opencontainers.image.revision=$GITHUB_SHA" \
--label="org.opencontainers.image.created=$(date --rfc-3339=seconds)"
- name: Test debian image
run: tests/run $IMAGE_NAME:debian
- name: Build alpine image
run: |
docker build . \
--pull=true \
--file=Dockerfile-alpine \
--tag="$IMAGE_NAME:alpine" \
--label="org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
--label="org.opencontainers.image.revision=$GITHUB_SHA" \
--label="org.opencontainers.image.created=$(date --rfc-3339=seconds)"
- name: Test alpine image
run: tests/run $IMAGE_NAME:alpine
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images to Docker Hub registry
if: github.ref == 'refs/heads/master'
run: |
docker push $IMAGE_NAME
docker push $IMAGE_NAME:debian
docker push $IMAGE_NAME:alpine